2017-03-06 36 views
1

我遇到問題我想我可以解決我的問題,如果我可以在嘗試重新安裝之前卸載'ggplotly'。ggplotly將無法工作或重新安裝 - 有沒有一種方法來卸載它?

這裏發生了什麼:當我試圖在家裏當教練演示了它,這工作得很好

代碼失敗。這是R Markdown。逐行調查問題代碼單元,問題集中在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 
+1

您可以使用函數'remove.packages'刪除已安裝的軟件包 – tictocchoc

+0

謝謝!那工作。很快就會在完整答案中發佈它。 – TMWP

回答

2

按照評論在此線程,一個包可以去安裝了remove.packages。由於每對這個職位最初的問題,去安裝和重新安裝被清除,但爲了完整性,這裏有所有的預防措施,我把改善這個工作的機會:

  1. 去除包裝指示
  2. 重新初始化RStudio(退出而不保存工作區,並重新進入它)
  3. 默認情況下,它想起了我的一些環境,所以我點擊掃帚圖標,以清除從內存
  4. 重新所有變量和數據安裝包
  5. 重新加載原始R文件和進行測試以確保所有按預期工作。

這是我在去安裝和控制檯看到重新安裝相反的原帖中顯示的消息:

在去安裝:

> 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 
相關問題