你好,
这个 JSL 脚本运行没有任何问题(我在 Windows 10 Pro 64 位下使用 JMP 16.0.0 (512257))并生成预期的 png 输出图表在 JMP 中:
LoadExprs = Expr(
InitR = Expr(
R Init();
R Submit( "
library(dplyr)
library(ggplot2)
library(palmerpenguins)
" );
);
MakePlot = Expr(
R Submit(
Eval Insert(
"\[
ggplot(data = penguins, aes(x = bill_length_mm, y = flipper_length_mm, colour = species)) +
geom_point() +
facet_wrap(. ~ island, nrow = 3)
]\
"
);
);
);
CapturePlot = Expr(
JMP_plot = R Get Graphics( png );
New Window( "Imported Plot", Picture Box( JMP_Plot ) );
);
RunClose = Expr(
R Term(); //Close r connection
);
);
LoadExprs;
InitR;
MakePlot;
CapturePlot;
RunClose;如果我尝试使用完全相同的 R 代码直接调用 R 脚本,它会失败并显示错误消息“获取 ''png' 的数据失败”。
这是 JSL 脚本:
LoadExprs = Expr(
InitR = Expr(
R Init();
);
RunR = Expr(
R Submit File( "C:\Users\xxx\R_projects\JMP\R_JPM_integration_1.R" );
);
CapturePlot = Expr(
JMP_plot = R Get Graphics( png );
New Window( "Imported Plot", Picture Box( JMP_Plot ) );
);
RunClose = Expr(
R Term(); //Close r connection
);
);
LoadExprs;
InitR;
RunR;
CapturePlot;
RunClose;
这个简化的 JSL 脚本,我的第一次尝试,也失败了,并显示相同的错误代码:
R Init();
R Submit File( "C:\Users\xxx\R_projects\JMP\R_JPM_integration_1.R" );
R Get Graphics( png );
R Term();
这是我用于此测试的简单 R 脚本:
library(dplyr)
library(ggplot2)
library(palmerpenguins)
ggplot(data = penguins, aes(x = bill_length_mm, y = flipper_length_mm, colour = species)) +
geom_point() +
facet_wrap(. ~ island, nrow = 3)
这与第一个脚本中的 R 代码相同。
R 提交文件调用有问题吗? 我错过了什么?
我更愿意使用R提交文件因为它节省了打字工作。