Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 使用openxlsx包保存xlsx工作簿时出错_R - Fatal编程技术网

R 使用openxlsx包保存xlsx工作簿时出错

R 使用openxlsx包保存xlsx工作簿时出错,r,R,我将在R Statistics中查看openxlsx包中的vignette示例,但我无法保存工作簿,也无法找出原因。下面的代码是从vignette中修改的示例,只是为了保持简单 setwd("c:/users/kenneth/documents/r/2014-04-29_openxlsx") require(openxlsx) require(ggplot2) wb <- createWorkbook() addWorksheet(wb, sheetName = "Motor Trend

我将在R Statistics中查看openxlsx包中的vignette示例,但我无法保存工作簿,也无法找出原因。下面的代码是从vignette中修改的示例,只是为了保持简单

setwd("c:/users/kenneth/documents/r/2014-04-29_openxlsx")
require(openxlsx)
require(ggplot2)
wb <- createWorkbook()
addWorksheet(wb, sheetName = "Motor Trend Car Road Tests", gridLines = FALSE)
addWorksheet(wb, sheetName = "Iris")
addWorksheet(wb, sheetName = "Conditional Formatting")
saveWorkbook(wb=wb, file="basics.xlsx", overwrite=TRUE) ## save to working directory
这是我的会话信息:

R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Danish_Denmark.1252  LC_CTYPE=Danish_Denmark.1252   
[3] LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C                   
[5] LC_TIME=Danish_Denmark.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_0.9.3.1 openxlsx_1.0.3 

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 digest_0.6.4     grid_3.1.0       gtable_0.1.2    
 [5] MASS_7.3-31      munsell_0.4.2    plyr_1.8.1       proto_0.3-10    
 [9] Rcpp_0.11.1      reshape2_1.4     scales_0.2.4     stringr_0.6.2   
[13] tools_3.1.0   

我已经更新到R、devtools和Rtools的最新版本。

我认为这里的问题是R找不到Rtools附带的zip应用程序

您可以使用命令检查Rtools bin目录是否位于R的系统路径中

shell("PATH")
输出应如下所示(取决于安装Rtools的位置):

如果Rtools\bin目录未出现在字符串中的任何位置,请将其添加进来

编辑系统路径的说明可在此处找到:
))


如果这不起作用,请给我发电子邮件,我会进一步帮助你(电子邮件在小插曲中)

Excel是[编辑]中的一个难题。我对
xlsx
XLConnect
软件包的运气更好。
Sys.getenv(“R\u ZIPCMD”,“zip”)
说了什么?@Luca。它不会返回空的,而是“zip”“@CarlWitthoft谢谢你的建议。我认为这些库很棒,但我有一些大型工作簿,java版本占用了我所有的内存。我无法回避这个问题,这就是为什么我对这个软件包感兴趣。谢谢你的回答。我为Rtools添加了两条路径,现在它可以工作了。谢谢与OP有相同的问题。我在路径变量中添加了以下内容:c:\RBuildTools\3.2\bin;C:\RBuildTools\3.2\gcc-4.6.3重新启动计算机后,shell(“路径”)的输出反映了更改,我不再收到有关压缩工作簿的错误消息。
shell("PATH")
PATH=c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;C:\Windows\system32;C:\... etc