Subscribe Bookmark RSS Feed

JMP and R

bluenose

Community Trekker

Joined:

Sep 11, 2011

Hello,

I saw that people connect R and JMP, and build graphical interfaces for R via JMP, in other words, for some R procedure, they build a GUI like interface that allow to drage variables in the JMP superb style.

How do I do it ? I read a bit about how to connect R to JMP from JSL, but how do I create this GUI, let's say for a very simple procedure, for example, if I have a variables X and Y, and I want to perform: mean(x), how to I build a GUI that does that ?

thanks...

3 REPLIES
mattf

Community Trekker

Joined:

Jun 23, 2011

Hi:

A simple example:

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

coldlg = column dialog("Test R Connection",

    

     response = collist("Var", data type(numeric), min col(1) )

);

If(coldlg["buttun"]==-1, throw("User Canceled"));

colnames = coldlg["response"];

xmat = [];

for(i=1, i<=nitems(colnames), i++,

     xmat = xmat || (column(colnames) << get as matrix );

);

R Init();

R Send(xmat);

R Submit("

     mean_x <- mean(xmat);

");

mean_x = R Get(mean_x);

R Term();               // done with R for now;

Show(mean_x);

Caption( "R Calculated Mean = " || char(eval(mean_x)) );

// For more dialog examples - see Murphy and Lucas, "Jump into JMP Scripting" - great book.

Best regards,

-Matt

bluenose

Community Trekker

Joined:

Sep 11, 2011

Hello,

I have tried the sample code, the data table opened indeed and so did the dialog box, but when I pressed "Ok", nothing happened...

I suspect a problem with the R connection. Does it also work on 64 bit systems ?

Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Yes, the connection to R works with 64-bit systems.

Please check the Log window in JMP for any errors after submitting the sample code.

-Jeff

-Jeff