我有一个问题,我认为我可能能够解决我的,如果我可以卸载'ggplotly‘之前,试图重新安装它。
下面是所发生的事情:
当老师演示它的时候,代码工作得很好,但是当我在家里尝试的时候却失败了。是。通过逐行研究问题代码单元,问题的中心是ggplot2 (它使用ggplotly)。下面提供了代码和错误消息。在代码中,“图”是一个应该传递到ggplot2 facet_wrap()中的ggplotly。
下面是我的控制台中关于这个问题的摘录,以及通过重新安装来修复它的失败尝试:
> ggplotly(graph)
Error in dev_fun(tmpPlotFile, width = deviceWidth, height = deviceHeight) :
unable to start png() device
> ggplotly(graph)
Error in RStudioGD() :
Shadow graphics device error: r error 4 (R code execution error)
In addition: Warning messages:
1: In grDevices:::png("C:/Users/User/AppData/Local/Temp/Rtmp0ar20f/3b613ba7d0ce4228bc937aee7cfcb112.png", :
unable to open file 'C:/Users/User/AppData/Local/Temp/Rtmp0ar20f/3b613ba7d0ce4228bc937aee7cfcb112.png' for writing
2: In grDevices:::png("C:/Users/User/AppData/Local/Temp/Rtmp0ar20f/3b613ba7d0ce4228bc937aee7cfcb112.png", :
opening device failed
> install.packages("plotly")
Error in install.packages : Updating loaded packages
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning message:
In gzfile(file, mode) :
cannot open compressed file 'C:\Users\User\AppData\Local\Temp\Rtmp0ar20f/libloc_190_4464fd2b.rds', probable reason 'No such file or directory发布于 2017-03-06 17:03:23
根据这个线程上的注释,可以用remove.packages卸载一个包。根据这篇文章最初的问题,去安装和重新安装清除了它,但为了完整起见,以下是我为提高这一工作机会所采取的所有预防措施:
这是我在控制台中看到的,与原始帖子中显示的消息形成对比的是,卸载和重新安装:
在去安装期间:
> remove.packages("plotly")
Removing package from ‘C:/ProgramFilesCoders/R/R-3.3.2/library’
(as ‘lib’ is unspecified)
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning message:
In gzfile(file, mode) :
cannot open compressed file 'C:\Users\User\AppData\Local\Temp\Rtmp0ar20f/libloc_190_4464fd2b.rds', probable reason 'No such file or directory'在重新安装期间:
> install.packages("plotly")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/plotly_4.5.6.zip'
Content type 'application/zip' length 817502 bytes (798 KB)
downloaded 798 KB
package ‘plotly’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\RtmpGco6OK\downloaded_packages https://stackoverflow.com/questions/42617659
复制相似问题