我尝试从 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 已更新以解决该问题
关于java - RCaller 3.1 入门,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41042312/