首页 > 解决方案 > 全新安装后加载 tidyverse 时出错 - R (loadNamespace, broom, backports)

问题描述

我刚刚将 R 更新到 4.0.2 版,并将 RStudio Desktop 更新到 1.3.959 版。从下面的代码中可以看出,在似乎成功安装之后,我无法加载 tidyverse 。但是, data.table 安装和加载非常好。这个事情谁有经验?谢谢!

来自控制台的代码(tidyverse 错误):

> install.packages('tidyverse')
Installing package into ‘C:/Users/iangm/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘RColorBrewer’, ‘scales’, ‘dplyr’, ‘ggplot2’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/RColorBrewer_1.1-2.zip'
Content type 'application/zip' length 55583 bytes (54 KB)
downloaded 54 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/scales_1.1.1.zip'
Content type 'application/zip' length 560984 bytes (547 KB)
downloaded 547 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/dplyr_1.0.0.zip'
Content type 'application/zip' length 1302777 bytes (1.2 MB)
downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/ggplot2_3.3.2.zip'
Content type 'application/zip' length 4068169 bytes (3.9 MB)
downloaded 3.9 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/tidyverse_1.3.0.zip'
Content type 'application/zip' length 440050 bytes (429 KB)
downloaded 429 KB

package ‘RColorBrewer’ successfully unpacked and MD5 sums checked
package ‘scales’ successfully unpacked and MD5 sums checked
package ‘dplyr’ successfully unpacked and MD5 sums checked
package ‘ggplot2’ successfully unpacked and MD5 sums checked
package ‘tidyverse’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\iangm\AppData\Local\Temp\RtmpkNazQW\downloaded_packages
> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’:
 .onLoad failed in loadNamespace() for 'broom', details:
  call: loadNamespace(name)
  error: there is no package called ‘backports’

来自控制台的代码(data.table 成功):

> install.packages('data.table')
Installing package into ‘C:/Users/iangm/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/data.table_1.12.8.zip'
Content type 'application/zip' length 2325868 bytes (2.2 MB)
downloaded 2.2 MB

package ‘data.table’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\iangm\AppData\Local\Temp\RtmpkNazQW\downloaded_packages
> library(data.table)
data.table 1.12.8 using 2 threads (see ?getDTthreads).  Latest news: r-datatable.com

标签: rtidyverse

解决方案


包可能存在一些问题backports:尝试重新安装该包并再次加载 tidyverse:

install.packages("backports")
library(tidyverse)

如果这不起作用,那么在 R 的早期主要版本(即 3.x)下构建的软件包可能存在问题。尝试使用以下命令重新安装所有软件包:

update.packages(ask = FALSE, checkBuilt = TRUE)

在此处查看更多信息:


推荐阅读