rClr in C# through R.NET

Aug 16, 2014 at 6:29 AM
Edited Aug 16, 2014 at 6:32 AM
Hi,

I think we can use any R library in C# through the R.NET. And one of R library, rClr should be available in C#, and I tried the code below.

** c# code
REngine.SetEnvironmentVariables();
REngine engine = REngine.GetInstance();

engine.Evaluate(@"Sys.setenv(RCLR='Mono')");
engine.Evaluate(@"library(rClr)"); //EvaluationException was unhandled at this line.
But I can't load library, rClr, and I got error below.
** Error (RDotNet.EvaluationException )
Error: package or namespace load failed for 'rClr'
I can use any c# function in R with rClr. In addition, I like to control R codes in my c# codes. Is it available? I think R.NET would be the answer.

I found the page edited by Jperraud about "Using the Mono runtime", https://r2clr.codeplex.com/wikipage?title=Quick%20start . And I tried it. I think I should check if the Mono is working well.

Regards, Neo
Coordinator
Aug 16, 2014 at 12:19 PM
Loading rClr from R.NET is probably not possible. See this work item in R.NET. The reason is that rClr runs an embedded CLR (microsoft CLR or Mono) and initializes one. I am pretty sure there can be only one CLR per process. The .NET runtimes seem (understandably ) not designed to support the scenario you describe. If a hack is at all possible, it would be a lot of work deep in the C/C++ layer.
Coordinator
Aug 16, 2014 at 12:19 PM
Loading rClr from R.NET is probably not possible. See this work item in R.NET. The reason is that rClr runs an embedded CLR (microsoft CLR or Mono) and initializes one. I am pretty sure there can be only one CLR per process. The .NET runtimes seem (understandably ) not designed to support the scenario you describe. If a hack is at all possible, it would be a lot of work deep in the C/C++ layer.