Using R.net with C# from Visual Studio error The program '[11012] tryR.exe' has exited with code 2 (0x2).

  • Thread starter Thread starter pulyka
  • Start date Start date
P

pulyka

Guest
I have Visual Studio 2017, RdotNet version v4.0.30319, R version 3.4.1

Tried to create the example program:

using RDotNet;
namespace tryR
{
class Program
{
static void Main(string[] args)
{
string result;
string input;
REngine engine;
REngine.SetEnvironmentVariables(rPath:"P:\\Program Files\\R-3.4.1\\bin\\i386", rHome:"P:\\Program Files\\R-3.4.1");
engine = REngine.GetInstance();
engine.Initialize();

//input
Console.WriteLine("Please enter the calculation");
input = Console.ReadLine();

//calculate
CharacterVector vector = engine.Evaluate(input).AsCharacter();
result = vector[0];

//clean up
engine.Dispose();

//output
Console.WriteLine("");
Console.WriteLine("Result: '{0}'", result);
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
}
and when running the code, I got the error message: The program '[11012] tryR.exe' has exited with code 2 (0x2). when executing the REngine.GetInstance(); statement


(I tried to launch R from the above directory and it started correctly).

Thanks for any advice

Continue reading...
 

Similar threads

P
Replies
0
Views
176
Policy standard local admin account with Active Di
P
Back
Top