install.packages() cannot open url问题

install.packages() cannot open url

在老师的建议下开始学习数据爬虫,但在安装rvest包时出现了问题
警告如下:

> install.packages("rvest")
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/src/contrib:
  cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/src/contrib:
  cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
  package ‘rvest’ is not available (for R version 3.5.1)
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/3.5:
  cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/PACKAGES'

对该问题进行了查询,发现是由于cran下载镜像造成的。
我使用的镜像是默认的外国镜像。
在更改镜像后rvest包正常安装。

具体操作参考:R语言 解决不能安装包的问题install.packages() cannot open url

猜你喜欢

转载自blog.csdn.net/woooooood/article/details/82917151