To update R using RStudio, you can follow these steps:
- Install the installr package (Windows only) or use the updateR() function from the rstudioapi package (macOS and Linux).
- Run the appropriate function to update R.
- Restart RStudio.
Please note that the installr package is available only for Windows. If you’re using macOS or Linux, you must update R manually by downloading the latest version from the R website and installing it.
Using Windows
You can download a new version of R from CRAN. Then restart your RStudio. The new R version will be loaded automatically. The new R version appears right after I install R and restart RStudio.
Another way is following via code.
# Install the 'installr' package if not already installed
if (!requireNamespace("installr", quietly = TRUE)) {
install.packages("installr")
}
# Load the 'installr' package
library(installr)
# Update R
updateR()
After running the updateR() function, follow the instructions in the dialog windows.
Once the update is complete, restart RStudio.
Using MacOS and Linux
Unfortunately, there’s no built-in function to update R on macOS or Linux. Instead, you’ll need to manually update R by following these steps:
- Go to the Comprehensive R Archive Network (CRAN) website: https://cran.r-project.org/.
- Download the latest version of R for your operating system (either macOS or Linux).
- Install the downloaded R package following the installation instructions for your operating system.
Restart RStudio.
After installing the new version and restarting RStudio, you should be running the latest version of R. You can check the current R version by running:
version
That’s it.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.