r - R 找不到 shell.exec (Mac OSX)
问题描述
我是 R 和 RStudio 的新手;在 Mac OSX 10.15.7 中使用它们。我正在尝试运行一个用户编写的程序来执行一些统计数据并将结果输出到预先组织的 excel 电子表格中,该电子表格以特定的方式将它们可视化。
该程序无法在我的机器上运行,但显然可以在程序作者的机器上运行(我与他们交谈过)。
当我运行程序时,我收到以下错误:
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
[1/2] Analysing proc traj outcomes
[2/2] Writing output file
Error in shell.exec(output_file) : could not find function "shell.exec"
我搜索了提到 shell.exec 的语法,发现以下内容:
step <- step + 1
cat(paste0("[", step, "/", total, "] Writing output file\n"))
if (xlsx_output){
create_excel(bic_df, prob_df)
if (open_file){
shell.exec(file.path(output_file))
}
} else{
create_txt(bic_df, prob_df)
if (open_file){
shell.exec(output_file)
shell.exec(output_txt)
}
}
我为这个问题的新手道歉。欢迎任何建议。
谢谢
解决方案
shell.exec
shell.exec(x)
是 R 中仅适用于 Windows 的命令。在 MacOS 上最接近的是system2("open", x)
. 但是,运行它时发生的情况可能会有所不同,因为它取决于系统上的文件关联,因此不能保证它是完全等价的。
推荐阅读
- ruby-on-rails - 模型 A 可以拥有一个模型 B,而模型 B 则拥有多个模型 A 吗?
- javascript - react-native 链接找不到 project.pbxproj 文件
- php - 为什么“and”这个词会使 MySQL 全文搜索如此缓慢?
- uwp - 如何使用广泛的文件系统访问访问 PC 中的磁盘驱动器?
- javascript - 如何限制从组合框 Extjs 中选择值
- apache-spark - shc-core: NoSuchMethodError org.apache.hadoop.hbase.client.Put.addColumn
- javascript - 根据内容文本更改背景颜色
- python - Python 3.5 .format() 方法
- javascript - 循环三位数字,其中 product == sum
- android - 带有材质组件的 MapView