This project is read-only.

Getting summary() output to C#

Feb 5, 2015 at 10:56 AM
I'm running very simple script for decision tree computation using csv file:

engine.Evaluate("data <- read.csv('"+path.Replace("\", "\\")+"')");
engine.Evaluate("data$target <- factor(data$target)");
engine.Evaluate("rules <- C5.0(target ~ ., data = data, rules=TRUE, control=C5.0Control(winnow = TRUE, minCases = 50))");
engine.Evaluate("tree <- C5.0(target ~ ., data = data, control=C5.0Control(winnow = TRUE, minCases = 50))");

GenericVector summary1 = engine.Evaluate("summary(rules)").AsList();
GenericVector summary2 = engine.Evaluate("summary(tree)").AsList();

And I can't get any meaningful info from summary1/2. R should output some huge string with tree output.

What should I do?
Feb 22, 2015 at 5:26 PM
Since we don't have your data, its difficult to reproduce your problem exactly. If you could build the most minimal example around mtcars, that would be helpful.

If I do this,
            var engine = REngine.GetInstance();
            engine.Evaluate("tree <- c(1,2,3,4,5,6,7,8,9)");
            GenericVector summary2 = engine.Evaluate("summary(tree)").AsList();
I get the correct result in summary2, so we know that the RDotNet layer is working. I would assume that there's a syntax issue with your code or something similar. Ensure that you have enabled break on execeptions in your debugger, or are catching and logging the RDotNet exceptions.