【问题标题】:R Shiny "R_ZIPCMD" path zipping errorR Shiny“R_ZIPCMD”路径压缩错误
【发布时间】:2017-08-01 10:30:20
【问题描述】:

我在 Ubuntu 16.04 的 R Shiny 服务器上有 2 个正在运行的应用程序。两者都进行一些数据操作(例如清理、连接表格等),然后将输出转储为 Excel 文件,其中包含类似以下功能的功能,

dumpExcel <- function(matched, non_matched=NULL, fileName, out_format='xlsx') {
    if (out_format == 'xlsx') {
        library(openxlsx)
        output <- createWorkbook()
        addWorksheet(output, "matched")
        if (!(is.null(non_matched))) { addWorksheet(output, "non_matched") }
        writeData(output,"matched", matched, colNames = T)
        if (!(is.null(non_matched))) { writeData(output,"non_matched", non_matched, colNames = T) }
        FileName = fileName
        saveWorkbook(output, FileName, overwrite = T)
        return(output)
    } else if (out_format == 'csv') {
        write.csv(matched, gsub('.xlsx', '.csv', fileName), row.names=F)
    }
}

对于第一个应用程序,此功能完美运行。对于第二个,它工作得很好,但不知何故现在不是,并抛出下面的错误,

Error in : zipping up workbook failed. Please make sure Rtools is installed or a zip application is available to R.
     Try installr::install.rtools() on Windows. If the "Rtools\bin" directory does not appear in Sys.getenv("PATH") please add it to the system PATH 
     or set this within the R session with Sys.setenv("R_ZIPCMD" = "path/to/zip.exe")

我已经尝试预先添加Sys.setenv(R_ZIPCMD = "/usr/bin/zip") 行,但没有成功。这个应用程序为什么会抛出这个错误,而同一服务器/机器中的另一个应用程序却运行良好?

非常感谢任何帮助...

【问题讨论】:

    标签: r ubuntu shiny zip shiny-server


    【解决方案1】:

    尝试在 server.R 中添加 Sys.setenv(R_ZIPCMD = "/usr/bin/zip")(在加载库之后,在 shinyServer(function(... 块之前。这对我有用。

    【讨论】:

    • 我真的希望这会奏效。不幸的是,这也不起作用。
    【解决方案2】:

    原来是内存问题。可用内存约为 200MB,增加到 >1GB,问题就解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-08
      • 2015-07-21
      • 1970-01-01
      相关资源
      最近更新 更多