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);
}