若是是默认的R安装通常会很慢html
install.packages(pkgs, lib, repos = getOption("repos"), contriburl = contrib.url(repos, type), method, available = NULL, destdir = NULL, dependencies = NA, type = getOption("pkgType"), configure.args = getOption("configure.args"), configure.vars = getOption("configure.vars"), clean = FALSE, Ncpus = getOption("Ncpus", 1L), verbose = getOption("verbose"), libs_only = FALSE, INSTALL_opts, quiet = FALSE, keep_outputs = FALSE, ...) install.packages("ABC",repos="http://mirror.bjtu.edu.cn/ "),换成北大的镜像或者清华镜像应该都会很快 若是想永久设置,就用options修改便可。
bioconductor其实也是有镜像的函数
source("http://bioconductor.org/biocLite.R") options(BioC_mirror="http://mirrors.ustc.edu.cn/bioc/") biocLite("RGalaxy")##这样就用中科大的镜像来下载包啦 ## bioconductor还有不少其它镜像:https://www.bioconductor.org/about/mirrors/ ##https://stat.ethz.ch/R-manual/R-devel/library/utils/html/chooseBioCmirror.html options(BioC_mirror="https://mirrors.tuna.tsinghua.edu.cn/bioconductor") options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
1.调用chooseCRANmirror函数: > chooseCRANmirror() R会显示CRAN镜像的列表。 2.从列表中选择镜像并点击肯定。 3.经过查看repos选项的第一个元素来获取所选镜像的URL地址: > options("repos")[[1]][1] 4.将下面的命令添加至.Rprofile 文件中: options(repos="URL") 其中的URL就是镜像的URL。 讨论 在每次安装R包的过程当中都会使用相同的CRAN镜像(即离本地最近的镜像地址)。你可能对于R重复地询问选择镜像感到厌烦。按照上述方法所给出的解决方案进行操做,便设定了默认的镜像,R每次就再也不询问了。 repos选项是默认镜像的名称。使用chooseCRANmirror函数选择镜像时会有一个重要的反作用,即按照选择来设定repos选项。问题是当R退出时,R不会保存选择的镜像为默认镜像。经过在.Rprofile中对repos进行设定,R在启动时会自动恢复你的设定。