R Shiny "R_ZIPCMD"路径压缩错误

标签 r ubuntu shiny zip shiny-server

我在 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")之前,它没有用。这个应用程序为什么会抛出这个错误,而同一服务器/机器中的另一个却运行良好?

任何帮助都非常感谢...

最佳答案

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

关于R Shiny "R_ZIPCMD"路径压缩错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42729218/

相关文章:

r - dplyr 按值组采样

json - rjson::fromJSON 只返回第一项

r - 输入字符串 1 无效 UTF-8 Shiny 应用程序

ruby-on-rails - 在 Aptana 3 (ubuntu) 中转到备用文件的快捷键

c - 编译器标志有什么用?为什么我的代码无法编译?

r - 列出 R 中数据帧中的所有不同字符串

ubuntu - 如果有可执行文件,则恢复已删除的 fortran 文件

r - 条件 react 性 Shiny

r - 在 Shiny 的服务器上增加堆栈维度

r - 如何将shapefile上传到Shiny App