我试图在我的Windows 7机器上运行这个简单的RCaller示例。
RCaller caller = new RCaller();
RCode code = new RCode();
caller.setRscriptExecutable("C:\\Program Files\\R\\R-3.2.1\\bin\\Rscript.exe");
double[] numbers = new double[]{1, 4, 3, 5, 6, 10};
code.addDoubleArray("x", numbers);
code.addRCode("my.mean<-mean(x)");
code.addRCode("my.var<-var(x)");
code.addRCode("my.all<-list(mean=my.mean, variance=my.var)");
caller.setRCode(code);
caller.runAndReturnResult("my.all");
double[] results = caller.getParser().getAsDoubleArray("mean");`
System.out.println(results[0]);
这是错误消息:
cat(makexml(obj=my.all, name="my.all"), file="C:/Users/Bob Smith/AppData/Local/Temp/Routput8089051805366000971")
rcaller.exception.ParseException: Can not handle R results due to : rcaller.exception.ParseException: Can not parse output: The generated file C:\Users\Bob Smith\AppData\Local\Temp\Routput8089051805366000971 is empty
我已经尝试了几个版本的RCaller(这个例子是2.2.0)并且收到了类似的错误。有谁知道如何解决这一问题?