ajoecker at gmx.de
2009-Sep-28 12:57 UTC
[R] JRI - get S4 objects from R and assign them again
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
Romain Francois
2009-Sep-30 06:15 UTC
[R] JRI - get S4 objects from R and assign them again
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