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

ajoecker at gmx.de ajoecker at gmx.de
Mon Sep 28 14:57:55 CEST 2009


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
-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser




More information about the R-help mailing list