Thursday, May 15, 2014

New Release: RCaller 2.3.0

New version of RCaller has just been uploaded in the Google Drive repository.

The new version includes basic bug fixes, new test files and speed enhancements.

XML file structure is now smaller in size and this makes RCaller a little bit faster than the older versions.

The most important issue in this release is the method

public int[] getDimensions(String name)

which reports the dimensions of a given object with 'name'. Here is an example:

int n = 21;
        int m = 23;
        double[][] data = new double[n][m];
        for (int i=0;i<data.length;i++){
            for (int j=0;j<data[0].length;j++){
                data[i][j] = Math.random();
            }
        }
        RCaller caller = new RCaller();
        Globals.detect_current_rscript();
        caller.setRscriptExecutable(Globals.Rscript_current);
       
        RCode code = new RCode();
        code.addDoubleMatrix("x", data);
        caller.setRCode(code);
       
        caller.runAndReturnResult("x");
       
        int[] mydim = caller.getParser().getDimensions("x");
       
        Assert.assertEquals(n, mydim[0]);
        Assert.assertEquals(m, mydim[1]);

In the code above, a matrix with dimensions 21 and 23 is passed to R and got back to Java. The variable mydim holds the number of rows and columns and they are as expected as 21 and 23.

Please use the download link

https://drive.google.com/?tab=mo&authuser=0#folders/0B-sn_YiTiFLGZUt6d3gteVdjTGM

to access compiled jar files of RCaller.

Good luck!