How to Change the R Version in RStudio?

Switching between different versions of R in RStudio is a straightforward process, provided the versions are installed correctly. Here is a step-by-step guide on how to do this:

Install the R versions

First, make sure you have the desired versions of R installed on your computer. You can download the necessary binaries from the Comprehensive R Archive Network (CRAN) at https://cran.r-project.org.


Open RStudio

Once your versions are installed, open RStudio.


Navigate to 'Global Options': From the top menu bar of RStudio, click on 'Tools' and then select 'Global Options'.


Change the R version

Within the Global Options dialog, there's a section called 'R Version'. Click the 'Change' button in this section. This will open a new dialog box showing all the installed versions of R that RStudio has detected on your system.

Select the R version

In this new dialog box, click the version of R you want to switch to and click OK. This closes the dialog box.

Apply the changes

Back in the Global Options dialog, click the Apply button to accept your changes, then click OK to close the dialog.


Restart RStudio

The changes will take effect when you close and reopen RStudio.


And that's it! You've changed the version of R that RStudio uses.


Remember that this change will affect all your projects unless you override it in the project-specific settings. To specify an R version for a specific project, open the project in RStudio, then go to Project Options in the File menu and follow the same steps.


In conclusion, while it's technically possible to have multiple versions of R, it's best to keep things simple and manageable by limiting the number of versions installed. And with the flexibility offered by RStudio, you can switch between versions as needed.