This article was reviewed by Luigi Oppido and by wikiHow staff writer, Hannah Dillon. Luigi Oppido is the Owner and Operator of Pleasure Point Computers in Santa Cruz, California. Luigi has over 25 years of experience in general computer repair, data recovery, virus removal, and upgrades. He is also the host of the Computer Man Show! broadcasted on KSQD covering central California for over two years.
This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources.
This article has been viewed 27,122 times.
Are you trying to update R easily? There are two ways to update R: via RStudio or manually. R is a coding language primarily for data visualization and statistical computing used in a wide variety of fields (such as data analysis). Thankfully, both methods of updating R are quick and easy. In this wikiHow, we'll teach you how to do both.
How to Get the Latest R Update
You can update R easily within RStudio thanks to a package called "installr" (for Windows) or "updateR" (for Mac). If you prefer to update manually, you can easily download the latest R version from CRAN's website and install it on your computer.
Steps
-
Open RStudio. On Windows, you can update R directly in RStudio with the "installr" package. MacOS doesn't have "installr," but you can use a similar package called "updateR" to update R instead.[1]
-
Run the installr or updateR command. Run the following command in RStudio to begin the update:
-
Windows:
install.packages("installr")
updateR()
library(installr)
-
Mac (where PASSWORD is your system password):
install.packages("devtools")
devtools::install_github("AndreaCirilloAC/updateR")
updateR(admin_password = "PASSWORD")
Advertisement -
Windows:
-
Allow the command to install the latest version of R. The "installr" or "updateR" package will check for a new version of R, download it, and install it for you.
-
Decide if you want to move your packages. After installing the new version of R, "installr" or "updateR" will ask if you want to move your packages to the new R library.
- Follow the on-screen instructions to move your packages, if you decide to.
-
Decide if you want to update your packages. After moving your packages, "installr" or "updateR" will offer to update your packages.
- Follow the on-screen instructions to update your packages, if you decide to.
-
Open the new Rgui and quit the old R. "Installr" or "updateR" will complete these tasks for you manually. Once you've quit the old R, your system will be updated to the latest version.
-
Go to the CRAN website for your operating system. You can manually download the latest version of R and install it on your computer, if you prefer. While you will have to move and install your R packages manually, this method gives you more control over the update process.
-
Download and run the installer for the latest version of R. The installer will walk you through the process. If you have RStudio open, make sure to close it.
-
Open RStudio once the new version of R is installed. RStudio will detect that a new version of R has been installed.
- To check what version of R your RStudio is using, run the command R.version.string. If the new version of R is shown, you can move on. Otherwise, do the following:
- Click Tools > Global Options > General > R version > Change.
- Select the new version of R.
- Click OK to close the "R Version Chooser" window.
- Click Apply and then OK to close the "Global Options" window.
- To check what version of R your RStudio is using, run the command R.version.string. If the new version of R is shown, you can move on. Otherwise, do the following:
-
Move your packages to the new R library. Go to your old R library, copy all of your package folders, and move them to the new R library. Your R libraries are found in the following locations by default:
- Windows: C:\Users\[your username]\Documents\R\win-library\[x.xx]
-
macOS: /Library/Frameworks/R.framework/Versions/[x.xx]/Resources/Library
- In the filepath, [x.xx] refers to the R version. You should go to the folder for the old version first, copy your packages, and then go to the folder for the new version to paste them.
-
Update your packages in RStudio. In RStudio, run the following command to update your packages. When prompted, press y for every question to update the packages.
update.packages(checkBuilt = TRUE)
-
Verify the version of your R install and packages. To make sure everything is updated properly, run the following command in RStudio. If your R version and package versions are displaying as the newest version, you've successfully updated R. If not, go back and repeat the steps in this article carefully.
version
packageStatus()