Hi, I have the following lines of code in C#:
string RpathOld = @"C:\Program Files\R\R-3.1.0\bin\x64";
string RpathNew = @"C:\Program Files\R\R-3.2.0\bin\x64";
try { REngine.SetEnvironmentVariables(RpathOld); }
catch { REngine.SetEnvironmentVariables(RpathNew); }
REngine engine = REngine.GetInstance();
But when it runs the last line I get an error:
An unhandled exception of type 'RDotNet.EvaluationException' occurred in RDotNet.dll
Additional information: Error: could not find function "memory.limit"
How can I solve this? I have tried to run the function "memory.limit()" in R and it works, giving me the RAM memory size.
Is there something I could to do to make R.Net work? Thanks.
Comments: This is a usually sign of a mismatch in R setting up its R_HOME environment variable. I would advise to set up both parameters ( r bin path and rHome path) in calling `SetEnvironmenbtVariables`. Unfortunately depending on whether one or more R versions are or were installed, and the state of the Windows registry, the automatic default path discovery is not always reliiable, hence the option to force specific paths). Hope this helps. As it happens I have managed to create a reproducible similar condition on one of my Windows machines while upgrading a version of R. I'll see what I can do to reduce or workaround these path issues. Hope this helps.
string RpathOld = @"C:\Program Files\R\R-3.1.0\bin\x64";
string RpathNew = @"C:\Program Files\R\R-3.2.0\bin\x64";
try { REngine.SetEnvironmentVariables(RpathOld); }
catch { REngine.SetEnvironmentVariables(RpathNew); }
REngine engine = REngine.GetInstance();
But when it runs the last line I get an error:
An unhandled exception of type 'RDotNet.EvaluationException' occurred in RDotNet.dll
Additional information: Error: could not find function "memory.limit"
How can I solve this? I have tried to run the function "memory.limit()" in R and it works, giving me the RAM memory size.
Is there something I could to do to make R.Net work? Thanks.
Comments: This is a usually sign of a mismatch in R setting up its R_HOME environment variable. I would advise to set up both parameters ( r bin path and rHome path) in calling `SetEnvironmenbtVariables`. Unfortunately depending on whether one or more R versions are or were installed, and the state of the Windows registry, the automatic default path discovery is not always reliiable, hence the option to force specific paths). Hope this helps. As it happens I have managed to create a reproducible similar condition on one of my Windows machines while upgrading a version of R. I'll see what I can do to reduce or workaround these path issues. Hope this helps.