Hi, I'm new to R but really would love to use it in my C# programs via RDotNet. I've added R.net via Manage NuGet Packages in VS2013 (RDotNet runtime Version v4.0.30319).
Within Windows 7 I'm running R-3.2.2 and both 32bit and 64bit reside within my C:\Program Files\R\R-3.2.2\bin folder.
Here's the beginning of my code.
using System.IO;
using System.Linq;
using RDotNet;
using RDotNet.NativeLibrary;
namespace RNetTest
{
class Program
{
static void Main(string[] args)
{
// Set the R_HOME environment variable in which R.dll is located.
Environment.SetEnvironmentVariable("R_HOME", @"C:\Program Files\R\R-3.2.2\bin\i386");
REngine engine = REngine.GetInstance("RDotNet");
It fails on the GetInstance with the error:
An unhandled exception of type 'System.ArgumentException' occurred in DynamicInterop.dll
Additional information: Could not retrieve a pointer for the symbol 'R_CStackLimit' in file 'RDotNet'
If I run REngine.GetInstance(); like is suggested I get the following error:
An unhandled exception of type 'System.Exception' occurred in DynamicInterop.dll
Additional information: This 32-bit process failed to load the library R.dll. Native error message is 'The system cannot find the file specified'
I've been wrestling with this for many hours now and finally asking for some help on what a solution might be. It should be noted the error is the same for 32bit or 64bit R.dll versions.
Comments: UPDATE: I restarted my machine to ensure that all of my environment variable changes actually took effect and now I'm back to my original error message when calling GetInstance(); Here is the error: REngine.SetEnvironmentVariables(); REngine engine = REngine.GetInstance(); The specified module could not be found System.Exception: This 32-bit process failed to load the library R.dll. Native error message is 'The operation completed successfully' at DynamicInterop.UnmanagedDll.ThrowFailedLibraryLoad(String dllFullName, String nativeError) at DynamicInterop.UnmanagedDll.ReportLoadLibError(String dllName, String nativeError) at DynamicInterop.UnmanagedDll..ctor(String dllName) at RDotNet.REngine..ctor(String id, String dll) at RDotNet.REngine.CreateInstance(String id, String dll) at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device) at RNetTest.Program.Main(String[] args) in c:\Users\cmenright\Documents\Visual Studio 2013\Projects\RNetTest\RNetTest\Program.cs:line 25
Within Windows 7 I'm running R-3.2.2 and both 32bit and 64bit reside within my C:\Program Files\R\R-3.2.2\bin folder.
Here's the beginning of my code.
using System.IO;
using System.Linq;
using RDotNet;
using RDotNet.NativeLibrary;
namespace RNetTest
{
class Program
{
static void Main(string[] args)
{
// Set the R_HOME environment variable in which R.dll is located.
Environment.SetEnvironmentVariable("R_HOME", @"C:\Program Files\R\R-3.2.2\bin\i386");
REngine engine = REngine.GetInstance("RDotNet");
It fails on the GetInstance with the error:
An unhandled exception of type 'System.ArgumentException' occurred in DynamicInterop.dll
Additional information: Could not retrieve a pointer for the symbol 'R_CStackLimit' in file 'RDotNet'
If I run REngine.GetInstance(); like is suggested I get the following error:
An unhandled exception of type 'System.Exception' occurred in DynamicInterop.dll
Additional information: This 32-bit process failed to load the library R.dll. Native error message is 'The system cannot find the file specified'
I've been wrestling with this for many hours now and finally asking for some help on what a solution might be. It should be noted the error is the same for 32bit or 64bit R.dll versions.
Comments: UPDATE: I restarted my machine to ensure that all of my environment variable changes actually took effect and now I'm back to my original error message when calling GetInstance(); Here is the error: REngine.SetEnvironmentVariables(); REngine engine = REngine.GetInstance(); The specified module could not be found System.Exception: This 32-bit process failed to load the library R.dll. Native error message is 'The operation completed successfully' at DynamicInterop.UnmanagedDll.ThrowFailedLibraryLoad(String dllFullName, String nativeError) at DynamicInterop.UnmanagedDll.ReportLoadLibError(String dllName, String nativeError) at DynamicInterop.UnmanagedDll..ctor(String dllName) at RDotNet.REngine..ctor(String id, String dll) at RDotNet.REngine.CreateInstance(String id, String dll) at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device) at RNetTest.Program.Main(String[] args) in c:\Users\cmenright\Documents\Visual Studio 2013\Projects\RNetTest\RNetTest\Program.cs:line 25