你好,
我有一些简单的脚本,它们调用了我在 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