Current Maintainer: @jeremydouglass from U. California Santa Barbara
Processing.R is a mode for Processing that enables users to write Processing sketches using the R language. The mode can be installed in the Processing Development Environment (PDE). It can also run on the command line as a stand-alone jar.
Processing.R supports:
- native R programming and syntax
- most Processing built-in functions (
draw()
,rect()
,box()
, etc.) - importing select Processing(Java) libraries (e.g. "peasycam")
- importing select R Packages (e.g. "foreach")
Processing.R is still in early development -- it is not feature-complete or production-ready. Please try our experimental mode and give us your feedback.
- Report bugs to Processing.R Issues!
Processing.R is currently available via PDE > Add Tool > Modes, you could install the mode in PDE.
To build the mode from source, see compilation.md.
Processing.R supports most of the Processing functions as described in the Processing reference. Processing.R functions are described on the documentation website:
However, the Processing.R documentation is currently incomplete. Many functions have not been tested or are not accompanied by example sketches. Some reference pages contain materials from Processing.py or Processing(Java) that have not been edited to reflect differences from other Processing modes.
Processing.R supports importing standard Processing(Java) libraries that enrich the functionality of Processing. The function importLibrary()
imports new libraries manually. This has been tested with one library: peasycam, the "dead-simple mouse-driven camera for Processing."
Before trying the example code below, first install the corresponding library peasycam
-- for example using the PDE Contribution Manager > Library.
settings <- function() {
importLibrary("peasycam")
size(200, 200, P3D)
}
setup <- function() {
cam = PeasyCam$new(processing, 100)
cam$setMinimumDistance(50)
cam$setMaximumDistance(500)
}
draw <- function() {
rotateX(-.5)
rotateY(-.5)
background(0)
fill(255, 0, 0)
box(30)
pushMatrix()
translate(0, 0, 20)
fill(0, 0, 255)
box(5)
popMatrix()
}
Processing.R has limited support for R packages. It will automatically download R packages that are requested using the library()
function, so you can use packages directly.
Here is an example using the foreach
package:
library(foreach)
foreach(i=1:3) %do%
print(sqrt(i))
In practice we have only found a few R packages so far that work with Processing.R "out of the box." This is because the package must be pure R and all of its dependencies must also be pure R. There is renjin list of R packages which lists their compatibility with the renjin JVM. Any package fully supported in renjin is theoretically supported in Processing.R.
See https://processing-r.github.io/. The documentation is generated from https://github.com/processing-r/Processing.R-docs-tools.
Feel free to hack on Processing.R! development.md will help you to get involved into the development of Processing.R.
See CHANGELOG
See AUTHORS
- Thanks processing for the Processing Development Environment(PDE).
- Thanks renjin for its awesome JVM-based interpreter for the R language.
- Thanks Jeremy Douglass for mentoring me in Google Summer of Code 2017.