Java RCaller获取未知大小的矩阵

Java RCaller获取未知大小的矩阵,java,rcaller,Java,Rcaller,我在Java中使用RCaller来执行外部R程序 问题是,我不知道矩阵的确切大小,但是.getAsDoubleMatrix方法希望得到该大小 double[][] matrix = caller.getParser().getAsDoubleMatrix("result", DONT_KNOW, DONT_KNOW); 有没有办法保持大小的动态性?通过,RoutputParser类现在有了getDimensions方法来获取矩阵的未知维数。以下是通过的测试文件: int n = 21; int

我在Java中使用RCaller来执行外部R程序

问题是,我不知道矩阵的确切大小,但是.getAsDoubleMatrix方法希望得到该大小

double[][] matrix = caller.getParser().getAsDoubleMatrix("result", DONT_KNOW, DONT_KNOW);
有没有办法保持大小的动态性?

通过,RoutputParser类现在有了getDimensions方法来获取矩阵的未知维数。以下是通过的测试文件:

int n = 21;
int m = 23;
double[][] data = new double[n][m];
for (int i=0;i<data.lengthi++){    
    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]);
最新编译的jar不包含此更新,但是,我计划下周准备一个版本2.3,或者您可以下载源代码并立即自己编译


请访问RCaller的官方博客页面了解最新版本

好的,谢谢,因此解决方案是没有解决方案:-/放松获取版本2.3.0,其中包含您使用链接请求的功能,这是新版本的博客条目: