[R] API request from R

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Feb 19 15:06:53 CET 2015


On Wed, Feb 18, 2015 at 11:44 AM, Mittal Ashra via R-help
<r-help at r-project.org> wrote:
> Dear All,
> Apologies for mailing it to the whole crowd. This is Mittal, presently working in a Project where we have build a platform for displaying recommendations and the results are based on the statistical models.
> I have gone through the CRAN repository to look out for an package which converts the R code into an JAVA API and that can be called from the platform. However, did not find any. If anyone can guide me to the right package that will be grateful.
> The packages can be similar to DeployR from Revolution Analytics.

 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



More information about the R-help mailing list