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

New Post: How to Query STRING VALUES from Dataframe

$
0
0
I'm a beginner..I wrote something like this:
        engine.Evaluate("library(ggplot2)");
        engine.Evaluate("data(mpg)");
        DataFrame df = engine.GetSymbol("mpg").AsDataFrame();
        for (int rowIndex = 0; rowIndex < df.RowCount; rowIndex++)
        {
            for (int colIndex = 0; colIndex < df.ColumnCount; colIndex++)
            {
                Console.Write(df[rowIndex, colIndex].ToString() + " ");
            }
            Console.Write(Environment.NewLine);
        }
I hope it returns like this:
    manufacturer  model displ year cyl trans drv cty hwy fl class
1           audi                     a4   1.8 1999   4   auto(l5)   f  18  29  p    compact
2           audi                     a4   1.8 1999   4 manual(m5)   f  21  29  p    compact
3           audi                     a4   2.0 2008   4 manual(m6)   f  20  31  p    compact
4           audi                     a4   2.0 2008   4   auto(av)   f  21  30  p    compact
...
but it returns like this
1 2 1.8 1999 4 4 2 18 29 4 2
1 2 1.8 1999 4 9 2 21 29 4 2
1 2 2 2008 4 10 2 20 31 4 2
1 2 2 2008 4 1 2 21 30 4 2
....
why&How to do?

Viewing all articles
Browse latest Browse all 1634

Trending Articles



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