After some trial and error I figured out how to pass matrices from R to java and back using rJava, but this method is not documented and I wonder if there is a better way?
Anyway, here is what I found works: (m = matrix(as.double(1:12),3,4)) [shows m as you would expect] jtest <- .jnew("JTest") (v <- .jcall(jtest, '[[D], 'myfunc', .jarray(m), evalArray=FALSE)) [shows v = m + 10] Here the JTest class has a method named myfunc that accepts a double[][] and returns a double[][]. It simply adds 10 to every element. The parameter 'evalArray' is confusing because when evalArray=TRUE the result is NOT evaluated (a list is returned that you then have to apply .jevalArray to do get the answer). There seems to be an option to have a java reference returned instead of the actual matrix. Can the R side manipulate the matrix (on the java side) through this reference? Thanks, Dominick [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel