Reputation: 1059
I copied the code right from the documentation http://jmp75.github.io/rdotnet/tut_basic_types/
REngine.SetEnvironmentVariable() and REngine.GetInstance() both give compiler errors saying 'RDotNet.REngine' does not contain a definition.
I installed nuget package R.Net Version 1.5.5 and I am running a c# console application.
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();
}
}
}
I googled and could not find an answer. Any ideas?
Upvotes: 3
Views: 2379
Reputation: 1059
There are two R.Net nugget packages from different publishers. I installed the wrong one. oops.
The right package for this example is R.NET.Community.
Upvotes: 5