0

I installed the previous version of R (4.0.5) and redirected RStudio according to the RStudio Support site here. However, I would now like to go back to the repository version (R 4.1.0), which is on my system at /usr/bin/R. After running export RSTUDIO_WHICH_R=/usr/bin/R to go back, the result of which R still outputs '/usr/local/bin/R' so I cannot open RStudio from the Desktop Applications Menu. When I try, it's looking for an R shared library (/usr/local/lib/R/lib/libR.so) even though I did build with the --enable-R-shlib option. If I open RStudio from the terminal, it opens fine with R 4.1.0

The support page says I need to change ~/.profile to be able to open RStudio from the Application Menu but I don't know how or where to change this. Is someone able to help with this? I would consider myself in the upper-beginner class of Linux user (I'm on Ubuntu 20.04).

I tried removing RStudio and the ~/.local/share/rstudio preferences and reinstalling but still have the same issue.

Thanks in advance, Jeremy

JJGabe
  • 304

1 Answers1

1

Make a backup of your .profile

Open a terminal and use the cp command as follows:

cp ~/.profile ~/.profile.bak

Edit the .profile file

Open the .profile file in a text editor. The last few lines may look like this:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Add a new line at the end of the last line and copy the command:

export RSTUDIO_WHICH_R=/usr/bin/R

Now the end of the file should look something like this:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
export RSTUDIO_WHICH_R=/usr/bin/R

Save the files and close the text file editor.

Log out and log back in so that the changes take effect.

Open RStudio and verify the R version from within RStudio.

If it does not work...

...revert back to the backup version of the .profile using the following command:

cp ~/.profile.bak ~/.profile

If it works...

...you may delete the backup file, or keep it for future reference.

Hope this helps

user68186
  • 37,461