[R] JRI - get S4 objects from R and assign them again

Romain Francois romain.francois at dbmail.com
Wed Sep 30 08:15:17 CEST 2009


Hi,

You should use this mailing list instead
http://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel.

... where I just posted something that might help you.

Romain

On 09/28/2009 02:57 PM, ajoecker at gmx.de wrote:
>
> Hello,
>
> I am writing a Java frontend for a selfwritten R program using JRI.
>
> Because I am working with my own S4 classes almost all of my R functions return a S4 object.
>
> In the Java Program I now need to run a R function and its result should be assigned to a new R variable afterwards.
>
>
> I tried REngine.eval(), but the returned REXP was always null.
> I tried also the rni methods:
>
> long result = re.rniParse("readInDataAndPreprocess(removemarked,removeflagged,substract_background)",1);
>      	System.out.println("Result:" + result);
>      	long r=re.rniEval(result, 0);
>          System.out.println("Result = "+r+", building REXP");
>          REXP x=new REXP(re, r);
>      	re.assign("resultReading", x);
>
> but the variable resultReading was not available in R afterwards.
>
>
> Has anyone of you an idea what I could do?
>
>
> Thanks in advance!
>
> Best,
> Anni


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
|- http://tr.im/yw8E : New R package : sos
`- http://tr.im/y8y0 : search the graph gallery from R




More information about the R-help mailing list