Re: [R] Using Java methods in R

From: lcn <lcn918_at_gmail.com>
Date: Tue, 26 Apr 2011 09:53:03 +0800 (CST)

> for(i in 1:3) for(j in 1:4) print(ar34Ret(i,j),digits=15)
>Error in print(ar34Ret(i, j), digits = 15) :
> could not find function "ar34Ret"
The way you used

ar34Ret(i, j)
was actually wrong. It should be ar34Ret[i, j], if nothing else wrong.

At 2011-04-25 08:06:51£¬hill0093 <hill0093_at_umn.edu> wrote:

>I added this R code to the bottom of the previous code and it doesn't work
>
>> ar34Ret <- .jcall(qsLin,returnSig="[[D","arReturnTEST")
>> print(ar34Ret,digits=20)

>[[1]]
>[1] "Java-Array-Object[D:[D_at_8813f2"
>
>[[2]]
>[1] "Java-Array-Object[D:[D_at_1d58aae"
>
>[[3]]
>[1] "Java-Array-Object[D:[D_at_83cc67"
>
>> for(i in 1:3) for(j in 1:4) print(ar34Ret(i,j),digits=15)
>Error in print(ar34Ret(i, j), digits = 15) :
> could not find function "ar34Ret"
>>
>
>The Java code is:
>public final static double[][] arReturnTEST() {
> double[][]retArr=new double[3][4]; for(int i=0;i<3;i++)for(int
>j=0;j<4;j++)retArr[i][j]=i*1000+j; return(retArr);
>}
>R doesn't know how to print the array in the next to final line,
>and thinks the array is a function in the final line.
>
>Any suggestions?
>
>
>--
>View this message in context: http://r.789695.n4.nabble.com/Using-Java-methods-in-R-tp3469299p3472308.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>R-help_at_r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 26 Apr 2011 - 02:26:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Apr 2011 - 05:00:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive