I have been trying to learn rJava to pass data back and forth between a set of Java applications I have programmed and R for analysis. I have a Java method with the signature
public double[][] method(void)
what I am going in R is as follows
library("rJava")
.jinit(parameters="-Xmx10240m")
s <- .jarray("string", "mainArgs")
javaobj <- .jnew("JavaClass", s)
data <- .jcall(javaobj, "[[D", "method")
At this point I have data that is supposed to contain the matrix I need to use but I am not understanding how to turn data from a Java matrix to a rJava matrix
data[1]
returns
[[1]]
[1] "Java-Array-Object[D:"
I have tried
as.list(data)
as.list(data[1])
as.list(data, simplify=TRUE)
.jsimplify(trees)
.jcastToArray(data)
.jevalArray(data)
.jevalArray(data, simplify=TRUE)
I am sure that what I am missing is obvious, but I just can't get it to work.