你好,
這個 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提交文件因為它節省了打字工作。