Support

Managing Packages with RStudio

Follow

Note: This article contains features only available in daily builds of RStudio 1.2.618 or newer, which are available in dailies.rstudio.com.

Overview

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

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:

Screen_Shot_2018-05-09_at_12.29.53_PM.png

Then, changing the "Primary CRAN repo" to a custom CRAN mirror or a custom package manager by providing its URL:

Screen_Shot_2018-05-09_at_12.32.03_PM.png

Secondary Repos

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:

Screen_Shot_2018-05-09_at_12.40.57_PM.png

Some package management solutions can also suggest package repos which, if available, will be listed while adding secondary repos as follows:

Screen_Shot_2018-05-09_at_12.43.21_PM.png

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

Screen_Shot_2018-05-09_at_12.46.51_PM.png

 

Comments