How to install an R package from source

If you want to install an older version of an R package the easiest way is to find the package version you need on CRAN and download the source file, you can do this step in your browser.

Once you are on the CRAN page for the package you need, look for an archive link next to Old sources: under Downloads.

Click this link and you will be taken to the archive that contains old package versions. Locate the package version you need and download the file (this file will end in tar.gz)

Once you have saved this file to your computer and extracted it you can use R to install the package using the usual install packages command with the following options:

install.packages("path/to/file", repos = NULL, type="source")

Note that installing from source means you will need to check yourself what dependencies (i.e other packages or libraries) are needed and install these too!

Good luck and may all your dependencies be met 😀