open source managing r versions

while rstudio server pro has a way to easily manage r versions, open source does not. from the documentation it is unclear how this is done -- documentation reads:

If you want to override which version of R is used then you can set the RSTUDIO_WHICH_R environment variable to the R executable that you want to run against. For example:

export RSTUDIO_WHICH_R=/usr/local/bin/R

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.

the question is does one define this in ~./profile?

Something like this:

Sys.setenv(RSTUDIO_WHICH_R = "/usr/local/bin/R")

Also, you probably mean ~/.Rprofile