我不太精通 JSL 脚本,因此作为测试,我让 ChatGPT-4 为我编写了一个 JSL 脚本。 我使用了 JMP 样本数据中的“玉米、小麦、大豆生产”数据表。 我的要求是:
“我有一个数据集来分析玉米、小麦和大豆的生产。 它由 5 列组成(年份、州、商品、种植的商品英亩数和种植的总英亩数)。 你能生成一个 JMP JSL 脚本来分析这些数据吗?”
作为响应,它生成了如下所示的 JSL 脚本。 但是,当我运行脚本时,它没有执行,也没有错误消息。 我对 JSL 了解不够,不知道为什么它不起作用。
我很好奇是否有任何经验丰富的 JSL 程序员愿意评论 ChatGPT 脚本的质量,并可能向我指出什么不起作用。 这个脚本是完全垃圾还是可能是一个小错误可以让它工作? 我确实手动插入了路径名,所以我可能搞砸了。 我在 Mac 上运行 JMP,因此路径名被相应地格式化。
这是 ChatGPT 生成的脚本:
// Import the data from a JMP file
dt = Open( "$SAMPLE_DATA/crop_production.jmp" );
// Calculate summary statistics for each commodity
commodities = {"corn", "wheat", "soybean"};
For( i = 1, i <= N Items( commodities ), i++,
dt_sum = dt << Summary(
Group( :Commodity ),
Weight( :Commodity acres planted ),
Statistics( Sum, Mean, Min, Max, Std Dev ),
Subsets( :Year, :State )
);
dt_sum << Select Where( :Commodity == commodities[i] );
dt_sum << Save Selected Rows(
"$SAMPLE_OUTPUT/" || commodities[i] || "_summary.jmp",
"jmp"
);
dt_sum << Delete Rows;
);
// Create a scatterplot matrix of the data
dt << Scatterplot Matrix(
Y( :Commodity acres planted, :Total acres planted ),
Group By( :Commodity ),
By( :Year, :State )
);
// Save the scatterplot matrix as an interactive HTML file
dt << Save Interactive HTML(
"$SAMPLE_OUTPUT/scatterplot_matrix.html",
Scatterplot Matrix
);
// Close the dataset
Close( dt, NoSave );