0

我正在处理 xlsx 文件,我想创建一个 Excel 文件,但它失败了。我正在使用openxlsx包。我的代码如下。

 wb=createWorkbook()
 addWorksheet(wb,"first")
 writeData(wb,"first","Roll no",startCol = 1,startRow = 1)
 writeData(wb,"first","Name",startCol = 2,startRow = 1)
 writeData(wb,"first","1",startCol = 1,startRow = 2)
 writeData(wb,"first","alvi",startCol = 2,startRow = 2)
 saveWorkbook(wb,"first.xlsx",overwrite = TRUE)

但我发现了这个错误。

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. 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")

我应该怎么办?还有其他方法可以做同样的工作吗?

4

0 回答 0