有時候利用R安裝R包,出現(xiàn)錯誤:
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 ‘readxl’ is not available (for R version 3.4.1)
可能是因為國外的rstudio或者其他源鏈接不上鱼填,此時換成國內(nèi)源即可解決問題宗收,更換方法如下:
##1. 使用Rstudio
打開
tool -> Global options -> packages
##2. 使用終端
在使用終端命令行安裝包的時候喳挑,可以直接指定源,命令如下:
install.packages(‘gdata’, repos = ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN’)
##3. 更改配置文件
linux或mac系統(tǒng)下叹放,安裝速度過慢渴杆,更改為國內(nèi)源方案,編輯~/.Rprofile, 指定國內(nèi)CRAN源:
options(repos=structure(c(CRAN=“https://mirrors.tuna.tsinghua.edu.cn/CRAN/”)))
指定國內(nèi)bioconductor源:
source(“http://bioconductor.org/biocLite.R”)
options(BioC_mirror=“http://mirrors.ustc.edu.cn/bioc/”)
biocLite(“clusterProfiler”)
通過Rprofile自定義函數(shù):
source.bioconductor <- function(){
? ? ? ? ? ? source("http://bioconductor.org/biocLite.R")
? ? ? ? ? ? options(BioC_mirror="http://mirrors.ustc.edu.cn/bioc/")
}
通過調(diào)用source.bioconductor()函數(shù)盖奈,改變源并安裝包
---------------------
作者:常玉俊bioinfo
來源:CSDN
原文:https://blog.csdn.net/chang349276/article/details/79295821
版權(quán)聲明:本文為博主原創(chuàng)文章混坞,轉(zhuǎn)載請附上博文鏈接!