Fix the version of R packages

Learn how to fix the version of R packages.

Written by Adam Pavlacka

Last published at: May 20th, 2022

When you use the install.packages() function to install CRAN packages, you cannot specify the version of the package, because the expectation is that you will install the latest version of the package and it should be compatible with the latest version of its dependencies. If you have an outdated dependency installed, it will be updated as well.

Sometimes you want to fix the version of an R package. There are several ways to do this:

When you use the Libraries UI or API (AWS | Azure | GCP) to install R packages on all the instances of a cluster, we recommend the third option.

The Microsoft R Application Network maintains a CRAN Time Machine that stores a snapshot of CRAN every night. The snapshots are available at<date> where <date> is the date of the desired snapshot, for example, 2019-05-01. To install specific versions of R packages, specify this URL as the repository of your CRAN library (AWS | Azure | GCP)when you create the library.

Was this article helpful?