4.74 FAQ-1220 How to download R packages from specific CRAN mirror by default?
Last Update: 6/20/2025
R supports downloading R packages from different CRAN mirrors.
If the default mirror is slow, you can change to use another mirror as default:
- Run Notepad as Administrator (right-click and select Run as Administrator). Browse and open the following file:
C:\Program Files\R\R-4.5.0\etc\Rprofile.site - Locate and edit
set a CRAN mirrorsection to specify the default mirrors. For example,# set a CRAN mirror local({r <- getOption("repos") r["CRAN"] <- "https://mirrors.tuna.tsinghua.edu.cn/CRAN/" r["Mirror1"] <- "https://ftp.yz.yamagata-u.ac.jp/pub/cran/" r["Mirror2"] <- "https://ftp.fau.de/cran/" r["Mirror3"] <- "https://cran.yu.ac.kr/" options(repos=r)})
Keywords:R package, CRAN mirror, install.packages(), repository