Could Not Find Function "sd" Error in C#

Feb 18, 2016 at 5:24 AM
Edited Feb 18, 2016 at 5:27 AM
I Develop a Simple program using RDotNet in C#.

I got "sd" function not found error. Can you give me some tips for solve this problem?

function "sd" is in "stats" package that is default library.

I already reinstall R(R-3.1.0-win.exe) again and again.

attached Error message and code as below.

"Error: could not find function "sd"
at RDotNet.REngine.Parse(String statement, StringBuilder incompleteStatement)
at RDotNet.REngine.<Defer>d__0.MoveNext()
at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source)
at RDotNet.REngine.Evaluate(String statement)"

The code as follow:
NumericVector group1 = regine.CreateNumericVector(examples);
regine.SetSymbol("group1",group1);

NumericVector STDResult = regine.Evaluate("sd(group1)").AsNumeric();

double[] arrSTD = STDResult.ToArray();
STD = arrSTD[0];
Thanks a lot.
Feb 20, 2016 at 12:57 AM
you need to let the engine know you are intending to use the stats library.

add :
rengine.Evaluate("library(stats)");
prior to STDResult.