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
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
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
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