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 secondary package management repos. This allows you to choose additional package repos that can be made available in your organization with solutions like drat and minicran; for instance, the cloudyr project maintains a drat repo under http://cloudyr.github.io/drat/ that could be easily added as a secondary repo from RStudio. Secondary repos can be named and added using "add..." from the preferences pane and then adding a named repo entry in the 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):