user242509
user242509

Reputation: 11

new version of R with rstudio

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

Answers (2)

duckmayr
duckmayr

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:

  1. You want to ensure RStudio uses a specific version of R when you are launching RStudio from the terminal as a one-time event.
  2. You want to ensure RStudio uses a specific version of R every time you launch RStudio from the terminal.
  3. You want RStudio to use a specific version of R when you launch RStudio from the applications menu (or, equivalently, via something like Synapse).

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.

One-time Terminal Launch

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.

Every Terminal Launch

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.

Launching from the Applications Menu

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

Kansrekenaar
Kansrekenaar

Reputation: 21

See the RStudio support pages. In particular, for Linux, you have to set the RSTUDIO_WHICH_R environment variable.

Upvotes: 1

Related Questions