美文网首页
error R:library不可写,contrib中读写索引读

error R:library不可写,contrib中读写索引读

作者: 胡童远 | 来源:发表于2020-11-11 11:44 被阅读0次

导读

新机中安装ggplot2遇到两个bug,如下:

install.packages("ggplot2")
Warning in install.packages("ggplot2") :
  'lib="C:/Program Files/R/R-3.6.3/library"'不可写
--- 在此連線階段时请选用CRAN的鏡子 ---
Warning: 无法在貯藏處https://mirrors.e-ducation.cn/CRAN/src/contrib中读写索引:
  无法打开URL'https://mirrors.e-ducation.cn/CRAN/src/contrib/PACKAGES'
Warning: 无法在貯藏處https://mirrors.e-ducation.cn/CRAN/bin/windows/contrib/3.6中读写索引:
  无法打开URL'https://mirrors.e-ducation.cn/CRAN/bin/windows/contrib/3.6/PACKAGES'
Warning message:
package ‘ggplot2’ is not available (for R version 3.6.3) 

1 设置library文件夹共享
解决'lib="C:/Program Files/R/R-3.6.3/library"'不可写的问题

install.packages("ggplot2")
C:/Users/hutongyuan/Documents/R/win-library/3.6’
(因为‘lib’没有被指定)
Warning: 无法在貯藏處https://mirrors.e-ducation.cn/CRAN/src/contrib中读写索引:
  无法打开URL'https://mirrors.e-ducation.cn/CRAN/src/contrib/PACKAGES'
Warning: 无法在貯藏處https://mirrors.e-ducation.cn/CRAN/bin/windows/contrib/3.6中读写索引:
  无法打开URL'https://mirrors.e-ducation.cn/CRAN/bin/windows/contrib/3.6/PACKAGES'
Warning message:
package ‘ggplot2’ is not available (for R version 3.6.3) 

lib使用了默认路径,但是第二个问题依旧存在

2 设置setRepositories
参考:R语言 install.packages 无法读取索引

setRepositories(addURLs =
c(CRANxtras = "http://cran.at.r-project.org/"))

然后就可以安装了

相关文章

网友评论

      本文标题:error R:library不可写,contrib中读写索引读

      本文链接:https://www.haomeiwen.com/subject/yejebktx.html