Reputation: 411
Having progressed my initial test of getting c#, R to work in our MVC web environment. I was trying to get the following code to work (taken from -> http://rdotnet.codeplex.com/)
To investigate this so far I have launched R from a cmd prompt and proven that I can enter these statements in R and get results, so I know that R is working. I have also run a very simple "Hello World" example proving that I can launch the R engine and get results back.
Then I wanted to go to a more complex question and I thought of Doing the Code from the codeplex.com page. To do something a bit more worthwhile than saying hello...
This is the snippet below. The Engine has already been created and I know is functioning from a previous test.
NumericVector group1 = Engine.Evaluate("group1 <- c( 30.02, 29.99, 30.11, 29.97, 30.01, 29.99)").AsNumeric();
NumericVector group2 = Engine.Evaluate("group2 <- c( 29.89, 29.93, 29.72, 29.98, 30.02, 29.98)").AsNumeric();
// Test difference of mean and get the P-value.
// what is in testResult
var testResult = Engine.Evaluate("t.test(group1, group2)").ToList();
at this point it errors and I get the message "Error in the application" and the following stack trace...
at RDotNet.REngine.Parse(String statement, StringBuilder incompleteStatement)
at RDotNet.REngine.<Defer>c__Iterator4.MoveNext()
at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source)
at RDotNet.REngine.Evaluate(String statement)
So my multiple questions on this are: -
is the example in the codeplex page Wrong? have I not done something? What does it mean? I feel that "error in the application" is not helping me find what I should do... Should I try some other examples or is the opinion of Dieter Menne in this stack overflow question the prevalent stance "unable to connect to R from c#" and I should move to the COM approach found here http://www.codeproject.com/Articles/25819/The-R-Statistical-Language-and-C-NET-Foundations
Although I am more interested in the mathematic and statistical rather than graphing.... I do want to make RDotNet work.... in c#
Upvotes: 0
Views: 1953
Reputation: 1539
To answer your several questions:
Documentation and latest developments:
Hope this helps.
Upvotes: 1