【问题标题】:r.net RDotNet.REngine does not contain a definition for 'GetInstance'r.net RDotNet.REngine 不包含“GetInstance”的定义
【发布时间】:2015-11-09 21:10:03
【问题描述】:

我直接从文档http://jmp75.github.io/rdotnet/tut_basic_types/复制了代码

REngine.SetEnvironmentVariable() 和 REngine.GetInstance() 都给出编译器错误,提示“RDotNet.REngine”不包含定义。

我安装了 nuget 包 R.Net 1.5.5 版,并且正在运行一个 c# 控制台应用程序。

using System;
using System.Linq;
using RDotNet;

namespace Sample1
{
    class Program
    {
        static void Main(string[] args)
        {
            REngine.SetEnvironmentVariables(); // <-- May be omitted; the next line would call it.
            REngine engine = REngine.GetInstance();
            // A somewhat contrived but customary Hello World:
            CharacterVector charVec = engine.CreateCharacterVector(new[] { "Hello, R world!, .NET speaking" });
            engine.SetSymbol("greetings", charVec);
            engine.Evaluate("str(greetings)"); // print out in the console
            string[] a = engine.Evaluate("'Hi there .NET, from the R engine'").AsCharacter().ToArray();
            Console.WriteLine("R answered: '{0}'", a[0]);
            Console.WriteLine("Press any key to exit the program");
            Console.ReadKey();
            engine.Dispose();

        }
    }
}

我用谷歌搜索并找不到答案。有什么想法吗?

【问题讨论】:

    标签: r.net


    【解决方案1】:

    有两个来自不同发行商的 R.Net nugget 包。我安装错了。哎呀。

    此示例的正确包是R.NET.Community

    【讨论】:

    • 请编辑您的答案!我犯了同样的错误,此示例的正确包是 R.NET.Community!
    • 你们有什么办法找到的吗?就像我不安装软件包并仅使用带有 dll 的 R.Net 一样。我将通过安装获取 dll,然后将其卸载以直接从 dll 中使用。
    • 您可以通过选择添加引用和您的 dll 的文件位置来使用 dll
    猜你喜欢
    • 2013-03-06
    • 2017-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多