Publication date: 11/29/2021

This example initiates an R connection, sends a data table to R, prints it to the log, and closes the R connection.

`R Init();`

dt = Open( "$SAMPLE_DATA/Big Class.jmp", invisible );

R Send( dt ); // send the opened data table represented by dt to R;

R Submit( "print( dt )" );

`R Term();`

This example initiates an R connection, creates an R object, retrieves the object into JMP, and closes the R connection.

`R Init();`

`R Submit(`

` "`

` L3 <- LETTERS[1:3]`

` d <- data.frame(cbind(x=1, y=1:15), Group=sample(L3, 15, repl=TRUE))`

`"`

);

R Get( d ) << NewDataView;

`R Term();`

This example initiates an R connection and plots the normal density function in R using the R graphics device,. Then the graph is retrieved from R and displayed in JMP. Finally, the R connection is closed.

`R Init();`

R Submit( "\[plot(function(x) dnorm(x), -5, 5, main = "Normal(0,1) Density") ]\" );

picture = R Get Graphics( "png" );

New Window( "Picture", picture );

`Wait( 10 );`

`R Term();`

This example initiates an R connection, sends a matrix to R, creates a matrix in R, adds them together, returns the new matrix to JMP, and closes the R connection.

`R Init();`

X = J( 2, 2, 1 );

`R Send( X );`

`R Submit(`

` "`

X #prints X to the log

Y <- matrix(1:4, nrow=2, byrow=TRUE) #makes a 2x2 matrix object Y

Y #prints Y to the log

Z <- X + Y #matrix object Z is addition of X and Y

`"`

);

`Z = R Get( Z );`

`R Term();`

`Show( Z );`

See the file JMPtoR_bootstrap.jsl in the sample scripts folder for an example script.

This script performs a bootstrap simulation by using the JMP to R Project integration.

The script produces a JMP window that asked the user to specify the variable to perform bootstrapping over. Then the user selects a statistic to compute for each bootstrap sample. Finally, the data is sent to R using the R interface in JSL.

The boot package in R is used to call the boot() function and the boot.ci() function to calculate the sample statistic for each bootstrap sample and the bootstrap confidence interval.

The results are brought back to JMP and displayed using the JMP Distribution platform.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).