我从文档http://jmp75.github.io/rdotnet/tut_basic_types/复制了代码
REngine.SetEnvironmentVariable() 和 REngine.GetInstance() 都给出编译器错误,说 'RDotNet.REngine' 不包含定义。
我安装了 nuget 包 R.Net 版本 1.5.5,并且正在运行 ac# 控制台应用程序。
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();
}
}
}
我用谷歌搜索并找不到答案。有任何想法吗?