Choose R version for one specific project

For a project, I have to use an R package that requires an older version of R (<= 3.3.1).

I see from the global options that I can choose any version of R to use in R Studio. However, I'd like to use the most recent version of R for all my other projects.

Question: Is it possible to choose a particular (older) version of R for just one specific project?

Thanks for your help!

It does not work that way in R. i believe you need to set up a separatee install of Rstudio with the old R in a separate project.

You can however choose a version of R in R studio in options and run your project, but if you need to run multiple projects with others in new versions it will confuse R and things will get wobbly in more than one project.

Safer to just run it together and probably I would choose a separate installation in a different partition, whatever it takes

Note: I am just a regular R user, and I do not develop for R.

Are you using RStudio Desktop, or RStudio Server? Project-specific R versions are a feature of RStudio Server Pro (see: https://support.rstudio.com/hc/en-us/articles/212364537-Using-multiple-versions-of-R-with-RStudio-Server-Pro).

As far as I know, RStudio Desktop can only use one version of R at a time. How this works is dependent to some extent on your operating system. See: https://support.rstudio.com/hc/en-us/articles/200486138-Changing-R-versions-for-RStudio-desktop

Another option might be setting up a Docker/rocker container for that project. There’s some useful discussion of Docker and R here:

2 Likes

Thanks a lot for this great list of resources! I'm on RStudio Desktop, so will have a look at the Docker option!

1 Like