开发者

Problem passing String[][] from Java to R using rJava

Is it possible to return from Java a String[][] to R using rJava?

I call the method

public String[][] readFromTable(String tableName, String security,
        String[] fields, String startTime, String endTime, boo开发者_如何转开发lean reverse)

from R with

   out <- .jcall(obj, "[[S", "readFromTable", tableName, security, .jarray(fields),
    start, end, reverse)

When I change the return type of the method to String[] everything works just fine, I experimented with the parameters and I am pretty sure that the problem is the String[][].

Has anyone got an idea?

EDIT 1:

Sorry, I forgot the error message:

Error in .jcall(obj, "[[S", "readFromTable", tableName, security, .jarray(fields), : method readFromTable with signature (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)[[S not found

EDIT 2

I just figured out that it works if I return a Double[][]...so maybe there is a bug in the String JNI implementation in the rJava package but that's hard to believe


[[Ljava/lang/String;

This will work


Have you tried to play with the .jarray? It was an issue of my problems.

.jarray(fields, contents.class="Ljava/lang/String")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜