From R.NET 1.5.3, it is much easier to handle data frames. See the example below:

public enum IrisSpecies
{
   setosa = 1,
   versicolor = 2,
   virginica = 3,
}

[DataFrameRow]
public class IrisData
{
   [DataFrameColumn("Sepal.Length")]
   public double SepalLength { get; set; }
   [DataFrameColumn("Sepal.Width")]
   public double SepalWidth { get; set; }
   [DataFrameColumn("Petal.Length")]
   public double PetalLength { get; set; }
   [DataFrameColumn("Petal.Width")]
   public double PetalWidth { get; set; }
   [DataFrameColumn("Species")]
   public IrisSpecies Species { get; set; }
}

var iris = engine.Evaluate("iris").AsDataFrame();
foreach (var row in iris.GetRows<IrisData>())
{
   Console.WriteLine(row.Species);
}

Last edited Aug 17, 2013 at 2:39 AM by kos59125, version 1

Comments

CathodeFollower Oct 18, 2013 at 12:49 PM 
I want to create a data frame in Dot Net, pass it in to R, process it, and then pass it back again. I was hoping that I could set up data frame rows and use them to construct a data frame, but I cannot see how to do this. Is it possible?

touchbutton Sep 16, 2013 at 3:23 PM 
This looks fantastic. It seems to be much easier now. How about handling properties dynamically without a class definition? Will that be possible in the future? Thanks!