你好,
我有一些簡單的腳本,它們呼叫了我在 JMP 17 中創建的 R 函數。我將 JMP 升級到了最新版本 (19.0.4),這些腳本就無法正常運作了。關於 R 與 Python 環境整合的文件比較少,所以非常感謝您的幫助。
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));
謝謝。
最好的,
TS
以下是 JMP 19 中 R 語言的精彩入門介紹:
腳本編寫者俱樂部錄製:R 語言重返 JMP 19 - 探索 R 和 Python 的集成
看來程式碼不需要修改。
只需安裝 R,然後從 R 中安裝 R 命令中使用的庫即可。
然後執行 JSL 程式碼——JMP 將透過 Python/ rpy2控制 R。
嗨,Hogi,
感謝您的回饋。很奇怪,在我的系統上,腳本崩潰了,沒有任何輸出。
我會檢查我的 R 配置,確保我安裝了正確的軟體包。
最好的,
TS
JMP社群的各位朋友,大家好!
我找到了腳本中的問題。我需要新增一個 UNLIST(data) R 指令,將 JMP 清單轉換為字串向量,這樣主指令才能正常運作。
最好的,
TS