Ubuntu 18.04 - I'm not able to change the version of R in RStudio

1

I installed RStudio through Anaconda manager. I managed to update the version of R on my computer to 3.6 (when I type R --version in my terminal, I get version 3.6), but when I check the version in RStudio using the version command, it tells me it's using 3.4.3. I tried following the instructions here (https://support.rstudio.com/hc/en-us/articles/200486138-Changing-R-versions-for-RStudio-desktop), although I wasn't able to do the last step

Note that in order for RStudio to see this environment variable when launched from the Ubuntu desktop Applications menu (as opposed to from a terminal) it must be defined in the ~/.profile file.

But I didn't think this was an issue because I was launching from the terminal, not from the desktop application

So I've got two questions about how to proceed

Firstly, how do I find out where on my computer R (version 3.6) is stored? I was able to find a bash script called R in /usr/bin. But then there's also a directory called R in /usr/lib. So I'm not exactly sure what RStudio is looking for. Which path do I give it? I tried installing an R package earlier just to see where it would end up. It looked like it was about to put it in /usr/lib/R/site-library, but then it prompted me to create a personal library in my home directory. So now I have three different R-related directories/files on my computer (that I know of), and don't know which one RStudio wants.

Secondly, once I figure out what RSTudio is looking for, how do I redirect RStudio to that location? The export $RSTUDIO_WHICH_R=/usr/bin/R instruction didn't seem to work. So how do I get it

Zuhaib Ahmed

Posted 2019-06-03T21:36:40.337

Reputation: 13

Answers

0

If you are going to run multiple versions or RStudio you need to install RStudio from source, recommended paths are listed in this RStudio Post

For your second question I have been using screen just after exporting RSTUDIO_WHICH like so:

export RSTUDIO_WHICH_R="/opt/R/3.6.2/bin/R";

[[ ! -d /run/screen ]] && sudo /etc/init.d/screen-cleanup start; screen -d -m rstudio;

I'm not familiar with attempting to launch different versions of R-Studio from the Anaconda manager, but I have created a bash script to install RStudio from source and launch specific versions of R in R-Studio you might be able to fork and modify for anaconda installs. I have only tested this for Debian/Ubuntu, but should work with any distro that's using the apt package manager.

seakintruth

Posted 2019-06-03T21:36:40.337

Reputation: 1