【发布时间】: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