Forcing Rstudio to use a specific version of R on

2019-07-26 07:04发布

问题:

My Rstudio (on linux) runs R version 3.3.0 and I don't have a clue what's directing it to do so. I'm using a VM, where my .bashrc file loads R 3.3.1 where I also set the RSTUDIO_WHICH_R env' variable to R 3.3.1 using:

export RSTUDIO_WHICH_R=`which R`

I've also set these two in the .bashrc file of root, but that neither prevents Rstudio from using 3.3.0.

Any idea how to force Rstudio to use the R version I want?

回答1:

Your solution is almost as it appears in this documentation, but I worry that the shell command expansion doesn't apply when being exported. To find out, what does echo $RSTUDIO_WHICH_R return? (tested, works fine).

Perhaps try executing which R and using that full path as the exported variable.

Update: From that documentation,

Not 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.