Switching R version on Ubuntu 22.04

On my Ubuntu server my default R version is 4.0.3.
I've installed R version 4.0.5 so i can then logon as root and install the rgdal package so that the libraries will be available to all users automatically.

My issue is that i do not know how to switch r version from 4.0.3 to 4.0.5 at Ubuntu terminal.
Is there an easy way to do this please?

This post shows how to set the version in the /etc/rstudio/rserver.conf file.

Hi technocrat, thanks for your help.

The docs you've mentioned, seem to point to changing the default R version for use in Rstudio\Posit workbench (as far as i can tell).
I do not want to do that.
i want to change the R version at the Ubuntu Server terminal.

For eg, right now i logon to the server, change to the 'root' account and the type 'R' which gives me the R prompt and tells me i'm using version 4.0.3

I'd like to type 'R' from the server terminal and have it load the R version 4.0.5 which is also installed.

How did you install the different versions of R? Personally I find it easiest to use GitHub - r-lib/rig: The R Installation Manager, which allows for transparent installation of multiple version of R including selecting the default to use.

If you want to roll your own: The version of R available in the terminal depends on the value of the PATH environment variable. It determines the order in which different directories are being searched for any binary to run.

I installed the different version of R by following Posit's doc, Posit - Install R - Posit Documentation

Unfortunately, I don't know much about the GitHub method, as fairly new to this stuff.

image

I’m confused. Do you want multiple versions?

I already have multiple versions installed as shown in previous screenshot.
I simply want to load R version 4.0.5 from Ubuntu terminal so I can install packages as a root user.

Hi All
I've found the answer.
I simply needed to run the below from Ubuntu Server cmd:

/opt/R/4.0.5/bin/R

Thanks for you help.

I'll probably look into using GitHub - r-lib/rig: The R Installation Manager, in the future, as this seems a better ongoing solution.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.