r - 无法在 R 中加载新的 ggplot2

标签 r ggplot2

我刚刚升级到新的 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 平台上使用 RStudio 0.99.842 运行 R 版本 3.2.1。有什么想法吗?

编辑:

我被要求提供安装命令的输出:

> 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

最佳答案

重新安装 ggplot2 后应重新启动 R。请参阅以下 Stackoverflow 链接,因为这是一个类似的问题

Error in fetch(key) : lazy-load database

关于r - 无法在 R 中加载新的 ggplot2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34593159/

相关文章:

r - 根据geom_map 或ggplot2 中的列联表(2x2)创建一个独特的图例?

r - 图形错误 : Don't know how to automatically pick scale

R Plotly 无法从条形图中删除跟踪 0

从 R 中的 TclTk GUI 返回变量

r - 'type = "范数时如何计算 ggplot stat_ellipse() 的面积”?

R 绘图使用 ggplot facet_grid 添加图例

r - ggplot2 采购错误 : X11 library is missing

mysql - 如何在 Mac OS 10.10.3 (Yosemite) 上使用 ODBC 将 R 连接到 MySQL 数据库

r - 如何下载geojson数据并将其读取到R

r - 如何使用r中的for循环使用先前的观察来预测下一个时期?