I want to run r-script from java. I have the following code, but giving null:
try {
RCaller caller = new RCaller();
caller.setRscriptExecutable("C:/Program Files/R/R-3.0.1/bin/x64/Rscript.exe");
caller.cleanRCode();
caller.addRCode("k<-1"); //Initializing k to 1
caller.addRCode("b<-print(k)");
caller.runAndReturnResult("b"); //This should output the value of b
} catch(Exception e) {
e.printStackTrace();
}
I don't know what I'm doing wrong. Please help out.