Installing R packages

The built-in R console allows users to install packages from the CRAN repository. The list of packages available for installation is updated on a weekly basis.

Installing R packages from CRAN

To list the packages available for installation at one or more repositories, run:


To install a package from a CRAN repository:


Since CRAN is a network of servers, known as mirrors, you can specify which mirror you would like to install the package from. Before selecting a mirror, check that it is whitelisted in your workspace.

To install a package from a specific CRAN mirror:

install.packages('readr', repos='mirror_url')

More detailed information on these commands are available from the R manuals at CRAN.

Installing R packages not hosted on CRAN

Because Internet access in the workspace is restricted, you will need to download the package that you want to install to your local machine first, and then upload it to the workspace. Make sure that dependencies are available on CRAN or you will have to upload them manually as well.

In this example, we will show you how to install ggman package used for creating Manhattan plots.

First, navigate to ggman GitHub repository, and download the package as a ZIP file.

Then, upload the ZIP file to the workspace folder of the R version in which you intend to install the package. In this example, we upload the ZIP file to ~/files/R/4.0.2/ directory.

Next, open the R console, and install the devtools package:


Then, load the devtools library:


Install the package:


Test the installation:


Package installation issues

In some circumstances, packages may fail to install. There are several possible reasons for this:

  • The necessary system requirements are not available.
  • The package is incompatible with the version of R running in the console. If you require access to a specific package that fails to install please contact the Service Desk.
Updated on April 1, 2021

Was this article helpful?

Related Articles

Not the solution you were looking for?
Click the link below to submit a support ticket