Calling R from Processing
Processing is a simple and powerfull programming language to create images, animation and interaction.
R is a powerfull free software environment for statistical computing.
For me this sounds like a perfect match. This is a short howto that shows how these two languages can comunicate with each other.
On the R-Side I use the Rserve extension, which can be installed by calling
install.packages("Rserve")
from within the R environment.
By calling
library(Rserve)
Rserve()
from within the R, you can start a serverprocess that accepts commands on a network socket and can be used by a javaclient to execute R commands.
In the processing sketch we need to add the two jar files of the javaclient that can be downloaded at the Rserve download page http://www.rforge.net/Rserve/files/
just add the jar files to the sketch using "Add file ..." from the "Sketch"-Menu.
Now we can use the REngine class to execute some R code in the server process and ask R to return the calculated data
read more ...