views:

548

answers:

3

Im building an application that i want to have extended with modules that does some nr crunching and i would like to have R for that. What are my best options for extending my Java application with R?

+4  A: 

You can use JRI. From that website:

JRI is a Java/R Interface, which allows to run R inside Java applications as a single thread. Basically it loads R dynamic library into Java and provides a Java API to R functionality. It supports both simple calls to R functions and a full running REPL.

This is part of the rJava project (which allows calling of Java from R)

Brian Agnew
+1  A: 

I've had a good experience integrating JGR, the Java Gui for R into my java application.

Note that the REngine is not multithread-safe. Thus, you need serialize access to the REngine (by, for example, letting it run in it's own thread). Your application and JGR would both update R variables and data frames using JRI. Now the great part about using JGR is that an R console is available so that the user can access the data being updated via your app, play with it, even change it on the fly, plot it, etc;! This combination of compiled (Java) and interpreted (R) modes is quite satisfying in terms of user experience.

Also, it looks like the JGR project is quite alive; I was using JGR 1.4, now it's at 1.7 (updated June 2009), so by all means, download it and give it a try.

If that works well and you're getting ambitious, look at biocep.

vijucat
thanx for your informative comment
Per Arneng
A: 

try RCaller, http://www.mhsatman.com/rcaller.php