【问题标题】:R cannot find shell.exec (Mac OSX)R 找不到 shell.exec (Mac OSX)
【发布时间】:2021-02-10 20:36:51
【问题描述】:

我是 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)
                }
        }

对于这个问题的新手,我深表歉意。欢迎任何建议。

谢谢

【问题讨论】:

    标签: r macos shell unix


    【解决方案1】:

    shell.exec 是 R 中仅适用于 Windows 的命令。在 MacOS 上与 shell.exec(x) 最接近的是 system2("open", x)。但是,当您运行它时会发生什么可能会有所不同,因为它取决于系统上的文件关联,因此不能保证完全等效。

    【讨论】:

      猜你喜欢
      • 2014-08-27
      • 2015-11-08
      • 1970-01-01
      • 1970-01-01
      • 2013-04-03
      • 2011-03-08
      • 1970-01-01
      • 2013-11-09
      • 2011-11-19
      相关资源
      最近更新 更多