Installing older versions of packages


Why install an older version of a package?

You may need to install an older version of a package if the package has changed in a way that is incompatible with the version of R you have installed, or with your R code. You may also need to use an older version of a package if you are deploying an application to a location such as, Shiny Server , or RStudio Connect where the environment may not allow you to run the latest version of the package.

Here are instructions on several methods you can use:

Using devtools to install older package versions

The simplest method is to use the provided install_version() function of the devtools package to install the version you need. For instance:

install_version("ggplot2", version = "0.9.1", repos = "")

Installing an older package from source

If you know the URL to the package version you need to install, you can install it from source via install.packages() directed to that URL. If you don’t know the URL, you can look for it in the CRAN Package Archive.

If you’re on Windows or OS X and looking for a package for an older version of R (R 2.1 or below), you can check the CRAN binary archive.

Once you have the URL, you can install it using a command similar to the example below:

packageurl <- ""
install.packages(packageurl, repos=NULL, type="source")

If you know the URL, you can also install from source via the command line outside of R. For instance:

R CMD INSTALL ggplot2_0.9.1.tar.gz

Note that if you are installing from source, you’ll need to make sure you have the necessary toolchain to build packages from source. On Windows, this may require you to install Rtools.

Potential issues

There are a few potential issues that may arise with installing older versions of packages: - You may be losing functionality or bug fixes that are only present in the newer versions of the packages. - The older package version needed may not be compatible with the version of R you have installed. In this case, you will either need to downgrade R to a compatible version or update your R code to work with a newer version of the package.

Have more questions? Submit a request


Powered by Zendesk