Hi All,
Hope this helps. Thanks in advance!
The used code
I'm trying some sample codes in R.NET and planning to use it for an existing script. But I'm stuck with the following error
Error 'RDotNet.REngine' does not contain a definition for 'EagerEvaluate' and no extension method 'EagerEvaluate' accepting a first argument of type 'RDotNet.REngine' could be found (are you missing a using directive or an assembly reference?)I've added the reference for RDotNet version 1.5.5 from NuGet and tried using VS 2012 and 13. The R version used is 3.0.1.
Hope this helps. Thanks in advance!
The used code
private void button1_Click(object sender, EventArgs e)
{
string rhome = System.Environment.GetEnvironmentVariable("R_HOME");
if (string.IsNullOrEmpty(rhome))
rhome = @"C:\Program Files\R\R-3.0.1";
System.Environment.SetEnvironmentVariable("R_HOME", rhome);
System.Environment.SetEnvironmentVariable("PATH",System.Environment.GetEnvironmentVariable("PATH"));
REngine.SetDllDirectory(@"C:\Program Files\R\R-3.0.1\bin\i386");
using (REngine engine = REngine.CreateInstance("RDotNet"))
{
try
{
// import csv file
engine.EagerEvaluate("dataset<-read.table(file.choose(), header=TRUE, sep = ',')");
// retrieve the data frame
DataFrame dataset = engine.EagerEvaluate("dataset").AsDataFrame();
for (int i = 0; i < dataset.ColumnCount; ++i)
{
dataGridView1.ColumnCount++;
dataGridView1.Columns[i].Name = dataset.ColumnNames[i];
}
........................