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:
- Use the devtools package
- Download and install a package file from a CRAN archive.
- Use a CRAN snapshot.
When you use the Libraries UI or API 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> 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 when you create the library.