Skip to content

Commit

Permalink
additional support sample
Browse files Browse the repository at this point in the history
  • Loading branch information
jmp75 committed May 17, 2018
1 parent f426f2b commit cba616a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion SupportSamples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static void Main (string[] args)
REngine.SetEnvironmentVariables();
REngine engine = REngine.GetInstance();
//stackoverflow_27689786_2752565 (engine);
stackoverflow_27597542_2752565 (engine);
codeplex_discussion_647874(engine);
// you should always dispose of the REngine properly.
// After disposing of the engine, you cannot reinitialize nor reuse it
engine.Dispose();
Expand Down Expand Up @@ -67,5 +67,23 @@ static void stackoverflow_27597542_2752565 (REngine engine)
Console.WriteLine ("m$components[{0}] = {1}", i + 1, components [i]);
}
}

static void codeplex_discussion_647874(REngine engine)
{
var npkscript = @"
op <- options(contrasts = c('contr.helmert', 'contr.poly'))
npk.aov <- aov(yield ~ block + N*P*K, npk)
npk.sum <- summary(npk.aov)
";
engine.Evaluate(npkscript);
var m = engine.GetSymbol("npk.sum").AsList();
var df = m [0].AsDataFrame();
var names = df.Names;
var colnames = df.ColumnNames;
// should do some checkes on names

double[] meanSqr = df["Mean Sq"].AsNumeric().ToArray();
}

}
}
1 change: 1 addition & 0 deletions rcpp/rdotnetsamples/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Description: An R package with sample code for R.NET documentation
License: MIT
Imports: Rcpp (>= 0.12.1)
LinkingTo: Rcpp
Suggests: testthat

0 comments on commit cba616a

Please sign in to comment.