我尝试从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/

10-10 13:30