Configuring the Default Version of R

Workbench

When multiple versions of R are installed you will need to specify which version is the default one for new RStudio Pro Sessions. This can be done automatically via the system PATH. However, several other mechanisms are provided when more flexibility is required.

Note

This section of the docs applies only to RStudio Pro.

Single default version of R

RStudio Pro uses the version of R pointed to by the output of the following command:

$ which R

The which command performs a search for the R executable using the system PATH. Therefore, RStudio Pro defaults to this version of R.

For versions of R installed by system package managers this will be /usr/lib/R. For versions of R installed from source this will typically (but not always) be /usr/local/lib/R.

If you want to override which version of R is used, then you can use the rsession-which-r setting. For example:

/etc/rstudio/rserver.conf
rsession-which-r=/usr/local/lib/R

Note: This change will not take effect until the server is restarted.

Default version per user or group

You can use the User and Group Profiles feature to specify distinct default versions of R for various users and groups. For example, the following profile configuration uses R 4.2.2 as the system default, R 4.3.0 for the powerusers group, and R 4.0.0 for the user jsmith:

/etc/rstudio/profiles
[*]
r-version = /opt/R/4.2.2

[@powerusers]
r-version = /opt/R/4.3.0

[jsmith]
r-version = /opt/R/4.0.0

Note that r-version specifies the full path to the directory where R is installed.

User configurable default version

Users can also configure their own default version of R. This is done using the General pane of the Global Options dialog:

Set Default R Version

See the Disabling use of multiple versions section for details on how to disable version switching entirely either system-wide or on a per-user or per-group basis.