cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
] />

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Thierry_S
Super User

JMP 19.0.4 Windows > How Do I Convert JMP 17 script that include R functions (some deprecated)

Hi,

I have a couple of simple scripts that call R functions I created in JMP 17. I upgraded JMP to its latest version (19.0.4), and these scripts no longer work. The documentation is a bit thin about the integration of R into the Python environment, so your help would be highly appreciated.

Names default to here (1);

dt = current data table ();

nw = New Window ("ENSEMBL_ID COLUMN SELECTION",
		<< Modal,
		Text Box ("Select the ENSEMBL_ID column"),
		lcol = Col List Box (Data Table (dt),
							All,
							width (500)
							),
		Button Box ("OK", scol = lcol << get selected; switch = 1),
			
		Button Box ("CANCEL", switch = 0; Throw(1)),					
							
		);


If (switch, 
	enbl_col_list = as column (scol) << get values ();
	r init();
	R send (enbl_col_list);
	R Submit(	"\[library(biomaRt)
					library("org.Hs.eg.db")
					library("AnnotationDbi")
					output <- mapIds(org.Hs.eg.db, keys = enbl_col_list, keytype = "ENSEMBL", column = "SYMBOL")
					output_df <- as.data.frame (output)
					print(output_df)
					]\");
	
	dt_out = r get (output_df);
	R Term (),
Throw (1));

Thank you.

Best,

TS

Thierry R. Sornasse
3 REPLIES 3
hogi
Level XIII

Re: JMP 19.0.4 Windows > How Do I Convert JMP 17 script that include R functions (some deprecated)

Here is a great introduction to R in JMP 19: 
Scripters Club Recording: R is Back Again in JMP 19 - Exploring R and Python Integration 

seems that the code doesn't have to be adjusted.
Just install R and from R install the libraries which are used in the R command.

Then execute the JSL code - and JMP will control R via Python / rpy2

Thierry_S
Super User

Re: JMP 19.0.4 Windows > How Do I Convert JMP 17 script that include R functions (some deprecated)

Hi Hogi,

Thanks for your feedback. It's odd, on my system, the script crashes without producing any output.

I'll check my R configuration to make sure that I have the right package installed.

Best,

TS 

Thierry R. Sornasse
Thierry_S
Super User

Re: JMP 19.0.4 Windows > How Do I Convert JMP 17 script that include R functions (some deprecated)

Hi JMP Community,

I found the issue in my script. I needed to include an UNLIST(data) R command to convert the JMP list into a string VECTOR so the main command would work.

Best,

TS

Thierry R. Sornasse

Recommended Articles