tags:

views:

384

answers:

3

Hi guys,

Is it possible to run R in Processing through rJava/JRI? If I deployed a Processing app on the web, would the client need R on their system?

I'm looking to create an interactive information dashboard that I can deploy on the web. It seems that Processing is probably my best bet for the interactive/web part of things. Unfortunately, it doesn't look like there are many math/stats functions built-in. And there aren't any libraries for plotting data either.

I've been using R and gpplot2 for a few months and am thrilled (amazed) at how easily it manipulates and plots data.

So I'm wondering now if can get the best of both worlds and run R through a Processing applet.

From the JRI 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.

In a sense JRI is the inverse of rJava and both can be combined (i.e. you can run R code inside JRI that calls back to the JVM via rJava). The JGR project makes the full use of both JRI and rJava to provide a full Java GUI for R.

JRI uses native code, but it supports all platforms where Sun's Java (or compatible) is available, including Windows, Mac OS X, Sun and Linux (both 32-bit and 64-bit).

Thanks for the advice :)

+2  A: 

Can you write Java code (or access a Jar file) in Processing? If so, then you can absolutely do this. JRI provides a low level interface to R and I have yet to encounter something in R that couldn't be run through its functions.

See this related question for simple example of how to use it.

I haven't really used Processing other than to look at it a few times, but it was my understanding that it had its own language.

Shane
It has it's own SYNTAX, but it's Java, under the hood. It compiles to and runs on the JVM, packages in JAR, etc. It's edge is providing convenience functions for a lot of graphics operations, so you don't have to deal directly with Swing or any other Java2D or Java3D prims.
William Doane
+2  A: 

Hi,

I wrote some example code along these lines last year:

http://illposed.net/R4P.html

Best,

Bryan

Bryan Lewis