Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

Updated Wiki: Handling DataFrames

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

publicenum IrisSpecies
{
   setosa = 1,
   versicolor = 2,
   virginica = 3,
}

[DataFrameRow]
publicclass IrisData
{
   [DataFrameColumn("Sepal.Length")]
   publicdouble SepalLength { get; set; }
   [DataFrameColumn("Sepal.Width")]
   publicdouble SepalWidth { get; set; }
   [DataFrameColumn("Petal.Length")]
   publicdouble PetalLength { get; set; }
   [DataFrameColumn("Petal.Width")]
   publicdouble 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);
}

Viewing all articles
Browse latest Browse all 1634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>