我试图用write.xlsx编写xlsx文件,但出现此错误:

Error: zipping up workbook failed. Please make sure Rtools is installed or a zip application is available to R.
     Try installr::install.rtools() on Windows.

package ‘Rtools’ is not available (for R version 3.1.2)

现在我该怎么做才能解决此问题?

编辑:
我安装了Rtools:

>installr::install.rtools()

No need to install Rtools - You've got the relevant version of Rtools installed

但是在write.xlsx之后我仍然收到该错误

最佳答案

您应该检查R_ZIPCMD系统变量:

Sys.getenv("R_ZIPCMD", "zip")

默认值:“zip”。但是有可能必须设置环境变量。如果您确切知道位置,则可以进行设置:
Sys.setenv(R_ZIPCMD= "C:/SOMETHING_PATH/Rtools/bin/zip")

我有同样的问题,但是设置R_ZIPCMD解决了它。

关于r - 错误:尝试写时无法压缩工作簿。xlsx,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27952451/

10-09 05:38