Note: This article contains features only available in the RStudio 1.2 Preview.
R packages allow the R community to extend the base functionality provided in R with a rich set of packages available in package repositories.
CRAN, The Comprehensive R Archive Network, is the primary package repository in the R community. CRAN is a network of ftp and web servers around the world that store identical, up-to-date, versions of code and documentation for R.
RStudio uses the RStudio CRAN mirror (https://cran.rstudio.com) by default. This mirror is globally distributed using Amazon S3 storage so should provide good performance for all locales. You may, however, wish to override the default CRAN mirror. This can be done from the Tools menu, Global Options, Packages:
Then, changing the "Primary CRAN repo" to a custom CRAN mirror or a custom package manager by providing its URL:
While specifying the primary CRAN repo is sufficient in most cases, RStudio also allows you to specify additional secondary mirrors or secondary package management repos. This allows you to choose the fall-back mirror to your primary CRAN repo or additional package repos that can be made available in your organization with solutions like minicran. The named repos can be manually added using "add..." as follows:
Some package management solutions can also suggest package repos which, if available, will be listed while adding secondary repos as follows:
Notice that the secondary repos order is important since packages will be searched in priority, the order of the repos can be changed by moving up/down their priority (see also the repos options for additional information on this topic):