Skip to content
Prev 348345 / 398500 Next

API request from R

On Wed, Feb 18, 2015 at 11:44 AM, Mittal Ashra via R-help
<r-help at r-project.org> wrote:
I doubt there's anything smart enough to take a set of R functions
and magically create all the necessary Java boilerplate code that
constitutes an implementation of an API in Java (cynics would say Java
was all boilerplate...).

 There's the rJava package, which includes the JRI system for calling
R from Java. Then your java can kick off an R "engine" and do R stuff:

  [boilerplate code deleted]

  Rengine re=new Rengine(args, false, new TextConsole());

  [more deleted boilerplate]

  re.eval("data(iris)",false);

What you would have to do would be to write the Java
functions/methods/classes with the appropriate arguments for your API
and make them call the R code this way.

 I think RCaller is another way of doing this from Java - its not on
CRAN since its not an R package, its a Java library.

Barry