Home

Using JMP 9 and R Together

Published on 9/23/2010


An R Graph in JMP

JMP 9 is now able to talk to the popular open source statistical software R.

JMP Scripting Language (JSL) is what allows JMP and R to work together.

Here are the most useful JSL functions for R:

//initialize the R session: 
RInit()

//send a JMP object to R:
int RSend(JMPObject)

//get an object from R:
object = RGet(RVariableName)

//submit R code to R for processing: 
int RSubmit(RCode)

//get the last graph made by R:
picture = RGetGraphics(format)

//terminate the session: 
int RTerm()

Here is a simple program:

//open a JMP table:
dt = Open("$SAMPLE_DATA/Big Class.JMP", invisible(true));

//initialize the R session (R must be installed on your computer):
RInit();

//send the JMP data table to R:
result = RSend(dt);

//execute the R code. Make a scatterplot matrix:
RCode = "plot(dt)";
result = RSubmit(RCode);

//get the plotted graphic from R:
graphic = RGetGraphics(png);

//plot the graphic in JMP:
NewWindow("Graph from R", PictureBox(graphic));

//terminate the session:
result = RTerm();

Easy huh? The graphic at the top of this posting was done via the above code.

... views