Multiple versions of R

Data scientists prefer using the latest R packages to analyze their data. To ensure a good user experience, you will need a recent version of R running on a modern operating system. If you run R on a production server – especially if you use RStudio Connect – and plan to support multiple versions of R side by side so that your code, reports, and apps remain stable over time. You can support multiple versions of R concurrently by either installing our precompiled binaries, or building R from source. Plan to install a new version of R at least once per year on your servers.

A solid foundation for R

Administering R on the desktop is relatively easy, because desktops are designed for a single user at a specific time. Desktop users upgrade R versions and R packages as new software becomes available, leaving old versions and packages behind. Servers, on the other hand, are designed to support multiple people who want to access content across time. Servers are increasingly used for building data science labs in R, deploying R in production, and running R in the cloud. You may find that the same strategies you use to administer R on your desktop do not work as well on a server. In particular, upgrading your version of R must be handled differently.

If you upgrade R on your server as you do on your desktop, you could easily break some apps and disrupt your teams. Administrators should exercise caution when upgrading to a new version of R on a Linux server. Consider the following situations:

  • You are hosting apps on RStudio Connect and Shiny Server for more than a year. When you upgrade R, you break many of your older apps.
  • Your team is developing code on a shared instance of RStudio Workbench (previously RStudio Server Pro). When you upgrade R, you disrupt people’s work and break their code.

Instead of upgrading your existing version of R, a better solution to these problems is to run multiple versions of R side by side. This strategy preserves past versions of R so you can manage upgrades and keep your code, apps, and reports stable over time.

Do not use your linux package manager to to install R

To get multiple versions of R side-by-side, it's important that you do not use your linux package manager to install R. For example, do not use yum (on Red Hat / CentOS) or apt (Debian or Ubuntu).

When you install R from these package repositories, you will overwrite your existing R version, and your old version of R will no longer be available.

Installing R from pre-compiled binaries (recommended)

To get multiple versions of R side-by-side, you have two options:

  • Compile and build R from source code
  • Install R from pre-compiled binaries for your platform

Building R from source provides you with two benefits:

  • You can specify the installation folder
  • You have maximum flexibility to specify the exact configuration

However, building R from source is somewhat time-consuming, and could take several minutes every time you install R.

For this reason, RStudio provides pre-compiled binary downloads of R for  variety of Linux platforms.

To install R from a pre-compiled binary, follow the instructions at Install R.

Building R from source 

If you want to install R from source, follow the instructions at Install R from Source.

RStudio professional products

RStudio professional products automatically support multiple versions of R and provide additional features, such as having administrators control access to multiple versions, or allowing users to choose for themselves. RStudio Connect automatically provides R version matching. Running multiple versions of R side by side with RStudio Connect will ensure that your content remains stable over time.