在R中无法加载新的ggplot2

22

我刚刚升级到新的ggplot2软件包(2.0.0),但每次尝试加载它时都会出错。

> library(ggplot2)
Error in get(method, envir = home) : 
  lazy-load database 'C:/Users/<blahblahblah>/Documents/R/win-library/3.2/ggplot2/R/ggplot2.rdb' is corrupt
In addition: Warning messages:
1: package ‘ggplot2’ was built under R version 3.2.3 
2: In .registerS3method(fin[i, 1], fin[i, 2], fin[i, 3], fin[i, 4],  :
  restarting interrupted promise evaluation
3: In get(method, envir = home) :
  restarting interrupted promise evaluation
4: In get(method, envir = home) : internal error -3 in R_decompress1
Error: package or namespace load failed for ‘ggplot2’

我能在R中加载其他包,例如dplyr,这意味着我的“R_decompress1”函数没有任何问题,因为它在所有包中都需要。然后我认为CRAN上的二进制文件可能已损坏(不太可能,但很容易检查)。我使用github页面上建议的方法从当前源安装。

> devtools::install_github("hadley/ggplot2")
完成后,我收到了以下错误信息(与之前类似)。
> library(ggplot2)
Error in get(Info[i, 1], envir = env) : 
  lazy-load database 'C:/Users/jclutter/Documents/R/win-library/3.2/ggplot2/R/ggplot2.rdb' is corrupt
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
Error: package or namespace load failed for ‘ggplot2’

我正在使用Windows 7平台上的R版本3.2.1和RStudio 0.99.842。有什么想法吗?

编辑:

要求我提供install命令的输出:

> remove.packages('ggplot2')
Removing package from ‘C:/Users/jclutter/Documents/R/win-library/3.2(as ‘lib’ is unspecified)
> install.packages('ggplot2')
Installing package into ‘C:/Users/jclutter/Documents/R/win-library/3.2(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/ggplot2_2.0.0.zip'
Content type 'application/zip' length 1977623 bytes (1.9 MB)
downloaded 1.9 MB

package ‘ggplot2’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\jclutter\AppData\Local\Temp\1\RtmpAHUju4\downloaded_packages

我刚刚将其卸载并重新安装了。它干净地安装,没有任何警告。以下是输出:好的,不确定如何在此评论中添加输出...(似乎有点限制) - Justace Clutter
好的,我已经将安装命令的输出添加到原始帖子中。 - Justace Clutter
1
天啊......好的,我重新启动了,现在一切正常。我不知道安装包后需要重新启动 R。(将此作为答案添加,我会为您点赞) - Justace Clutter
1
通常情况下,你不会这样做,但这是一种通用的“你试过关掉再重新打开吗?”建议... - Ben Bolker
根据我的经验,我重新启动了R,确实起作用了。 - victordongy
显示剩余2条评论
1个回答

44

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接