R4P helps Processing and R interact.
It's distributed as an R package, but includes both R and Processing parts
and is generally designed to be used from Processing.
Processing programs invoke an
R engine using the Java-R interface (JRI) from the
R package. Many Processing functions are exposed to R scripts through a
high-level interface function. Similarly, Processing programs may use
R functions through the JRI interface.
The package also includes a basic Processing output device for
R4P includes a few example sketches that are installed into your Processing
Processing is really good for animation and interactive graphics; R not
R is fantastic for scientific computing and technical graphics; Processing
not so much.
Thus, R4P tries to make the languages relatively easily interoperable
to obtain a system good at technical interactive graphics, animation,
and scientific computing.
One of the included examples is a re-implementation of the "boids"
bird flocking simulation included in Processing. The new implementation
computes the flock motion in R but displays it with Processing. It also
shows how R can handle simple mouse interaction (the position of
a repulsor/attractor), as well as compute
flock density "contours." Contour plots, somewhat tricky
to produce natively in Processing, are one-liners in R. The example plot
was produced by R plotting to the Processing output device using:
The example may seem somewhat
contrived, but it does illustrate combining nifty features of each language.
A video of the example appears below:
Right now, it's only set up for use with GNU/Linux, although it can easily be
extended to other platforms like Windows.
Processing binaries are generally 32-bit programs (as of December '09).
However, most folks run 64-bit versions of R. Due to the tight coupling
of Processing and R in R4P, one must use bit-compatible versions of the
languages. That usually means manually building a 64-bit version of
Processing from source. Instructions may be found here:
Note that I've had trouble building certain parts of Processing on GNU/Linux;
in particular OpenGL support.
R4P is in infancy; expect issues and if capable, help to resolve them!
Please feel free to contribute.