[英]Getting started with RCaller 3.1
我尝试从RCaller开始,但是一开始我就失败了。
当我尝试运行任何示例时,该行
RCaller caller = RCaller.create();
给出以下异常:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.github.rcaller.rstuff.RCallerOptions.create(RCallerOptions.java:32)
at com.github.rcaller.rstuff.RCaller.create(RCaller.java:83)
at Test.main(Test.java:8)
Caused by: java.lang.NullPointerException
at java.util.Arrays.sort(Unknown Source)
at com.github.rcaller.util.Globals.<clinit>(Globals.java:65)
... 3 more
我猜想原因是在Globals.java中,有一些为R定义的路径不适合我的安装。 如果是的话,问题就变成了:
如何告诉RCaller我的R安装在哪里?
我知道在早期版本的RCaller中,类似
caller.setRScriptExecutable( String path );
caller.setRExecutable( String path );
存在,但是此命令不再起作用。
我也尝试手动更改Globals.java,
public static String RScript_Windows = "C:\\Program Files\\R\\R-3.0.2\\bin\\Rscript.exe";
public static String R_Windows = "C:\\Program Files\\R\\R-3.0.2\\bin\\R.exe";
至
public static String RScript_Windows = "E:\\R\\R-3.1.1\\bin\\Rscript.exe";
public static String R_Windows = "E:\\R\\R-3.1.1\\bin\\R.exe";
但这不是正确的解决方案,而且还是无法正常工作。
有谁知道合适的解决方案?
RCaller已更新,可以解决此问题
创建RCallerOptions并将选项设置为RCaller.create。 RCallerOptions.create接受R可执行路径和RScript可执行路径的参数。
RCallerOptions options = RCallerOptions.create("D:\\software\\R\\R-3.4.2\\bin\\Rscript.exe", "D:\\software\\R\\R-3.4.2\\bin\\R.exe", FailurePolicy.RETRY_1, 3000l, 100l, RProcessStartUpOptions.create());
RCaller caller = RCaller.create(options);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.