PApplet: Running a PApplet from R

Description Usage Arguments Details Value Examples

View source: R/PApplet.R

Description

Functions load, run and manipulate a processing PApplet via R.

Usage

1
2
3
4
5
PApplet(name, loc = NULL, title = "RProcessing")
PAddJar(path)
PClose(PApp)
PResize(PApp, x, y)
PSet(PApp, setter, ...)

Arguments

name

character string. Name of the PApplet class to run.

loc

integer vector of size two. x and y coordinate for opening the RApplet (defaults to c(100,100)).

title

character string. Title for the window used by the PApplet.

path

character string. Path and name of the jar file that contains the PApplet.

PApp

object of class PApplet as returned by PApplet()

x,y

integer. New size for the PApplet.

setter

character string. Name of the set method in the PApplet.

...

Argument list for the set method.

Details

Before using a processing (see http://processing.org) program, called a PApplet you have to create a jar file by using File/Export Application in the processing programming environment. Then you have to add the jar using PAddJar(). Now you can start the processing application called a PApplet via R using PApplet().

Now you can transfer data with PSet() to the PApplet using a set methods that you implemented in the applet.

Value

PApplet() returns an PApplet object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## example with external jar
PAddJar(system.file("examples","Cube3D.jar", package="rProcessing"))
app1 <- PApplet("Cube3D")


## use the built-in example PScatter
app2 <- PScatter(sample(1:500, 20), sample(1:500, 20))

## to close the PApplets you can use
#PClose(app1)
#PClose(app2)

#see how PScatter works 
PScatter
#you can find the processing source code file on your disk at
system.file("examples", "PScatter.pde", package="rProcessing")

rProcessing documentation built on May 2, 2019, 4:55 p.m.