This project is read-only.

Unable to run the R.Net sample code with c# and .net framework 4.0

Aug 17, 2012 at 11:54 AM
Edited Aug 17, 2012 at 12:07 PM

Hi,

I have install R environment with version 2.15.1 and having a R.net 1.4.1.0.

I am tring to execute sample code from my application which is a window form app with C# and .net framework 4.0.

Below is the code:

 REngine.SetDllDirectory(@"C:\Program Files\R\R-2.15.1\bin\x64");

 using (REngine engine = REngine.CreateInstance("RDotNet")) 

{ // .NET Framework array to R vector.  

NumericVector group1 = engine.CreateNumericVector(new double [] { 30.02, 29.99, 30.11, 29.97, 30.01, 29.99 }); 

 

engine.SetSymbol("group1"  , group1);  

 

 

// Direct parsing from R script

NumericVector group2 = engine.EagerEvaluate("group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)" ).AsNumeric(); 

 

// Test difference of mean (Student's t-test) and get the P-value.

 GenericVector testResult = engine.EagerEvaluate("t.test(group1, group2)" ).AsList();  

 

 

double p = testResult["p.value"]

.AsNumeric().First();

Console.WriteLine("Group1: [{0}]", string.Join(", "

, group1.Select(value => value.ToString())));

 Console.WriteLine("Group2: [{0}]", string.Join(", " 

, group2.Select(value => value.ToString())));  
 

 Console.WriteLine("P-value = {0:0.000}", p);  

}

 While executing program its giving an error "DLL was not found" on below line

using (REngine engine = REngine.CreateInstance("RDotNet")) .

I have checked all the path of the DLL

Please help its urgent.