[R] Problem with calling an user defined R function from Java

Surajit sbhatta3 at gmu.edu
Mon Oct 24 07:02:07 CEST 2011


Dear All,

I am facing a problem in calling an user defined R function from Java
through JRI. The user defined R function does a loess normalization on micro
array data ( find in the limma package of BioConductor) and the last 2 lines
of the R Code is :

MA <- normalizeWithinArrays(RG, method="loess")
return(MA$A) # where MA$A is the column A of MA.

Now while calling it in Java, I simply use the following code:
    String data;
    data="C:/Project_WRAIR/US09493743_251527910706_1_1 T10-105_5day_24hrs";
//where data is the input.
    re.eval("source('C:/Project_WRAIR/Normalisation.r')");
    System.out.println(re);
    REXP rn = re.eval("my.Normal(data)");
    System.out.println(rn);
    double[] rnd = rn.asDoubleArray();
      for(int i=0; i<rnd.length; i++){
      System.out.print(rnd[i] + " ");
    }

This gves an NullPointerException and on printing the variable rn, we get
null as the output.

Please do suggest a way out.

Thanks in advance.

Surajit Bhattacharya



--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-calling-an-user-defined-R-function-from-Java-tp3932071p3932071.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list