R install.packages() 设置国内CRAN镜像
使用 install.packages() 安装R包时,总是比较慢,有时甚至安装失败,失败情形如下:
> install.packages('gridExtra')
Warning in install.packages :unable to access index for repository https://cran.rstudio.com/src/contrib:无法打开URL'https://cran.rstudio.com/src/contrib/PACKAGES'
为避免这种情况,可以设置CRAN使用清华大学镜像,命令如下:
options(repos=structure(c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")))
之后再来安装包,速度很快:
> install.packages('gridExtra')
试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/macosx/el-capitan/contrib/3.5/gridExtra_2.3.tgz'
Content type 'application/octet-stream' length 1102824 bytes (1.1 MB)
==================================================
downloaded 1.1 MBThe downloaded binary packages are in/var/folders/kl/9xr58rsj4md0f1ngtxhq0bqh0000gn/T//RtmpuSD541/downloaded_packages
或者不用Rstudio,直接用R安装:
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
