我尝试从 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";
但这不可能是正确的解决方案,而且无论如何也不起作用。
有谁知道合适的解决方案?