i'm using JRI, to talk to R through Java. If i try to get the result of my R-Code as Double i get a NullPointer. Normally this is caused by an error of R. Is it possible to get the output of the R-Console into Java in order to read the error?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Ok. Here is what I did, to solve the problem.
because my REngine is a singleton i was able to perform those R-Expressions, after the creation:
re.eval("log<-file('"+filepath+"')");
re.eval("sink(log, append=TRUE)");
re.eval("sink(log, append=TRUE, type='message')");
this codes writes every R-Output into the file specified by the String filepath. For non-singletons i would recommend to extend the REngine...