错误:“tidyverse”的包或命名空间加载失败,没有名为“reprex”的包

时间:2021-01-28 16:58:11

标签: r tidyverse

library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘reprex’

我正在使用此版本的 R 版本 4.0.3 (2020-10-10) 我也尝试安装库“reprex”,但我有这个

install.packages("reprex")
also installing the dependency ‘withr’

trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/withr_2.4.1.tgz'
Warning in install.packages :
  cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/withr_2.4.1.tgz': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/withr_2.4.1.tgz'
Warning in install.packages :
  download of package ‘withr’ failed
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/reprex_1.0.0.tgz'
Warning in install.packages :
  cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/reprex_1.0.0.tgz': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/reprex_1.0.0.tgz'
Warning in install.packages :
  download of package ‘reprex’ failed

我有 macOS Big Sur

1 个答案:

答案 0 :(得分:1)

我在 MacOS big sur 上也遇到了完全相同的问题。它现在确实有效。我安装了 ggplot2 install.packages("ggplot2"),它也安装了 withr,它以前找不到的包。

同时安装依赖‘withr’

trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/withr_2.4.1.tgz'
Content type 'application/x-gzip' length 205896 bytes (201 KB)
==================================================
downloaded 201 KB

trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/ggplot2_3.3.3.tgz'
Content type 'application/x-gzip' length 4068756 bytes (3.9 MB)
==================================================
downloaded 3.9 MB

之后,我再次安装了tidyverse,问题解决了。

> install.packages("tidyverse")
also installing the dependency ‘reprex’

trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/reprex_1.0.0.tgz'
Content type 'application/x-gzip' length 478248 bytes (467 KB)
==================================================
downloaded 467 KB

trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/tidyverse_1.3.0.tgz'
Content type 'application/x-gzip' length 433049 bytes (422 KB)
==================================================
downloaded 422 KB

> library(tidyverse)
── Attaching packages ─────────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
✓ ggplot2 3.3.3     ✓ purrr   0.3.4
✓ tibble  3.0.5     ✓ dplyr   1.0.3
✓ tidyr   1.1.2     ✓ stringr 1.4.0
✓ readr   1.4.0     ✓ forcats 0.5.1

我不确定该解决方案是否确实安装了 ggplot2。这是我第一次使用 R。(我在 edX 上学习数据科学课程)

干杯!

  • 恩佐