Reputation: 605
I'm looking into using R.NET for working with R library in my .NET application. I have installed the libraries and the R environment.
However, i get the exception described above when running the sample program provided on the project page:
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();
}
In case anyone has run into this issue, i would be really glad to have any comments. I have searched relevant forum but no luck yet.
full exception information:
An unhandled exception of type 'System.ApplicationException' occurred in RDotNet.NativeLibrary.dll Additional information: Windows Registry key 'SOFTWARE\R-core' not found in HKEY_LOCAL_MACHINE nor HKEY_CURRENT_USER
I checked the R is properly installed and R-Core is found HKEY_LOCAL_MACHINE
Many thanks in advance
Upvotes: 0
Views: 2441
Reputation: 605
Please follow the diagnosis instructions in jmp75.github.io/rdotnet/ts_paths_on_windows . This would help isolate the issue. I suspect a mismatch between 32 and 64 bits in your c# project and R set up (which R engine did you install: 32 and/or 64 bits?) but this is just a wild guess without the aforementioned diagnosis.
Changing the target platform of my project solved the issue following the comment above
Upvotes: 3