rcaller 2.2 and 2.3 do not stop in sequential command mode with runAndReturnResultOnline

295 Views Asked by At

I'm working on a Windows 7 machine with R 3.1.0. I downloaded rcaller 2.2 and the latest 2.3 and followed the example of Sequential Commands in the tutorial. However, the program does not stop in Eclipse after the last line of code is executed.

The R.exe and Rterm.exe are still in the task manager. And every time I re-run the program, another R.exe and Rterm.exe are added in the task manager...

The following is the Java code:

import rcaller.RCaller;
import rcaller.RCode;

public class RCallerOnlineTest {
    public static void main(String[] args) {
        RCaller caller = new RCaller();
        // change to your path please
        caller.setRExecutable("C:/R/R-3.1.0/bin/x64/R.exe"); 
        RCode code = new RCode();
        caller.setRCode(code);
        code.addDoubleArray("x", new double[]{1.0, 2.0, 3.0, 4.0, 50.0});
        code.addRCode("result <- mean(x)");
        caller.runAndReturnResultOnline("result");
        double mean = caller.getParser().getAsDoubleArray("result")[0];
        System.out.println("mean: " + mean);

        boolean status = caller.stopStreamConsumers();
        System.out.println(status);
   }

}

The output is the following:

mean: 12.0
true

So the last print out true. I assume that it indicates rcaller is stopped, but it's not. Am I missing something here? I couldn't find a method called stop in the library...

1

There are 1 best solutions below

5
On BEST ANSWER

Thank you for your post. The revision 59bfd7335cb8 fixes this problem, at least I hope. The method StopRCallerOnline() in class RCaller now stops the R instance in the memory which is created in runAndReturnResultOnline(). All test files passed and there are no R processes still stay in the task manager.

After more comprehensive tests, I plan to compile and publish the version 2.4 in 15th June. But you are still able to download the source tree and compile yourself using maven

Hope works for you.