[R] R Data Frame to C# DataGridView - R.NET

swonder03 ramey.steven at gmail.com
Sun Oct 23 02:59:11 CEST 2011


This is more of a C# question, but it has to do with the conversion of a data
frame using R.NET into an appropriate format to display on a C#
DataGridView. 

My code is as follows (focusing on the button_Click)

/private void button_displayDF_Click(object sender, EventArgs e)
        {
            REngine engine = REngine.GetInstanceFromID("RDotNet");

            DataTable table = new DataTable();

            engine.EagerEvaluate("myDataFrame <- data.frame('Order' =
c(1,2,3,4,5),'Name' = c('Bob', 'Ryan', 'Mel', 'Mark', 'Ali'))");
            DataFrame dataset =
engine.EagerEvaluate("myDataFrame").AsDataFrame();

            dataGridView_DF.DataSource = dataset;
        }/


I've looked at this link:
http://psychwire.wordpress.com/2011/06/25/importing-and-displaying-a-data-frame-with-c-and-r-net/
but I'd like to avoid loops and take a more direct route. I have a feeling
I'm supposed to fill 'table' with the contents of 'dataset' but when I try
/dataset.Fill(table);/ the error returned is " 'RDotNet.DataFrame' does not
contain a definition for 'Fill' and no extension method 'Fill' accepting an
argument of type 'RDotNet.DataFrame' could be found (are you missing a
directive or an assembly reference?) " 

For how to connect to R using R.NET in C# see this page:
http://www.r-bloggers.com/making-guis-using-c-and-r-with-the-help-of-r-net/

--
View this message in context: http://r.789695.n4.nabble.com/R-Data-Frame-to-C-DataGridView-R-NET-tp3929413p3929413.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list