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! |
Hi,
ReplyDeleteI'm getting an error when running "DataFileExample.java" with RCaller 2.3.0: and R 3.1.0:
Exception in thread "main" rcaller.exception.ParseException: Can not handle R results due to : rcaller.exception.ParseException: Can not parse output: The generated file C:\Users\DIOGOR~1\AppData\Local\Temp\Routput8095126795141229916 is empty
at rcaller.RCaller.runAndReturnResult(RCaller.java:409)
at rCaller_test.DataFileExample.(DataFileExample.java:47)
at rCaller_test.DataFileExample.main(DataFileExample.java:59)
It seems that the generated xml file is always empty: cat(makexml(obj=data, name="data"), file="C:/Users/DIOGOR~1/AppData/Local/Temp/Routput5423426613685665392")
I've also installed RUniversal just in case, but same mistake.
Any help?
Thanks in advance:
Hi!
ReplyDeleteI am getting this error:
rcaller.exception.ExecutionException: runiversal.R in package: java.lang.NullPointerException
This is my code:
RCaller caller = new RCaller();
caller.setRscriptExecutable("C:\\Program Files\\R\\R-3.1.0\\bin\\Rscript.exe");
RCode code = new RCode();
(...)
The error happens when an instance of RCode is being created. The RCode constructor calls the method clear(), which return this exception.
I have already installed Runiversal package by using this command: install.packages("Runiversal")
Could you help me figure out what is wrong?
Thanks
Marilia