
Hello, I'm new to this library. I'm having problem making a very simple linear regression and getting its coefficients. My code is this:
double[] subidas = { 3.2, 6.4, 5.1 };
double[] bajadas = { 1.5, 3.1, 2.5 };
REngine.SetEnvironmentVariables();
REngine engine = REngine.GetInstance();
NumericVector ups = engine.CreateNumericVector(subidas);
NumericVector downs = engine.CreateNumericVector(bajadas);
NumericVector coeff = engine.Evaluate("coefficients(lm(ups ~ downs))").AsNumeric();
And is throwing me the following error:
"Error in eval(expr, envir, enclos) : object 'ups' not found"
Please help, thanks in advance!



'ups` as created is a C# variable but is not a named variable in R. To set it in R, try this:
engine.SetSymbol("ups", ups);
engine.SetSymbol("downs", downs);
That should set the variable in R to have the symbol "ups" point to the data in ups.



I tried it and now it's working, thanks!

