有時候利用R安裝R包,出現錯誤:
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或者其他源鏈接不上,此時換成國內源即可解決問題,更換方法如下:
1. 使用Rstudio
打開
tool -> Global options -> packages
2. 使用終端
在使用終端命令行安裝包的時候,可以直接指定源,命令如下:
install.packages(‘gdata’, repos = ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN‘)