java - RCaller get matrix of unknown size -


i'm using rcaller in java in order execute external r program.

the problem is, don't know exact size of matrix .getasdoublematrix() method wants have size.

double[][] matrix = caller.getparser().getasdoublematrix("result", dont_know, dont_know); 

is there way keep size dynamic?

by revision e263b5393d43, routputparser class has getdimensions() method getting unknown dimensions of matrix. here passed test file:

int n = 21; int m = 23; double[][] data = new double[n][m]; (int i=0;i<data.lengthi++){         (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]); 

the latest compiled jar not include update, however, plan prepare version 2.3 next week or can download source , compile immediately.

visit official blog page of rcaller latest release here


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -