Managing Packages with the RStudio IDE



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.

Primary Repos

The RStudio IDE uses the RStudio CRAN mirror ( 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:


You can configure the RStudio IDE with the RStudio Package Manager for even easier way to organize and centralize packages across your team, department, or entire organization.

Secondary Repos

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 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):