Reputation: 11
I installed a new version of R but rstudio still uses the old version. The command "which R" is just a shell script and I'm not sure how to get rstudio and the new version of R integrated. R base installed in /usr/share/doc.
Any tips?
Thanks, Bob
Upvotes: 1
Views: 2675
Reputation: 16940
As found out in the comments, you're on a Linux system, specifically Linux Mint 17. I can see three basic scenarios here:
They are dealt with in turn below. I assume throughout that the path to the R binary you want RStudio to use is /opt/R/3.1.0/bin/R
, which you should change as appropriate.
After opening a terminal via Ctrl-Alt-T, run
export RSTUDIO_WHICH_R=/opt/R/3.1.0/bin/R
Then, anytime you launch RStudio from the terminal via the rstudio
command in that terminal session, it will use the specified R version. However, after you exit
, the next time you open the terminal, it will no longer respect that choice.
Use your favorite text editor to edit the file ~/.bashrc
. At the end, on a new line, add
export RSTUDIO_WHICH_R=/opt/R/3.1.0/bin/R
Then, either launch the terminal, or if you already have it open run the command source .bashrc
. Then, you can launch RStudio via the command rstudio
and it will use the version of R you want.
Use your favorite text editor to edit the file ~/.profile
. At the end, on a new line, add
export RSTUDIO_WHICH_R=/opt/R/3.1.0/bin/R
Then you need to log out of your system and log back in. After that, anytime you launch RStudio from the application menu, it will use the specified R version.
Upvotes: 1
Reputation: 21
See the RStudio support pages. In particular, for Linux, you have to set the RSTUDIO_WHICH_R
environment variable.
Upvotes: 1