0

I try to start with RCaller, but I fail at the very beginning.
When I try to run any example, the line

RCaller caller = RCaller.create(); 

gives the following Exception:

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

I guess the reason is that in Globals.java, there are paths defined for R, which do not fit my installation. If that's right, the question becomes:
How can I tell RCaller where my R is installed?
I know that in earlier versions of RCaller, something like

caller.setRScriptExecutable( String path );
caller.setRExecutable( String path );  

existed, but this commands don't work anymore.
I also tried to change the Globals.java manually, changing

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";

to

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";

but this can't be the right solution, and it doesn't work anyway.
Does anyone know a proper solution?

Tom Grille
  • 11
  • 2

2 Answers2

1

RCaller has been updated to fix the problem

Tom Grille
  • 11
  • 2
1

Create RCallerOptions and set the options to RCaller.create. RCallerOptions.create takes parameters of R executable path and RScript executable path.

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);
Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123
madhu
  • 11
  • 1