PDF download Download Article
Learn how to update R on your Windows or Mac computer
PDF download Download Article

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.

Method 1
Method 1 of 2:

Automatic Update with RStudio

PDF download Download Article
  1. 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]
  2. Run the following command in RStudio to begin the update:
    • Windows:

      install.packages("installr")
      library(installr)

      updateR()
    • Mac (where PASSWORD is your system password):

      install.packages("devtools")
      devtools::install_github("AndreaCirilloAC/updateR")
      updateR(admin_password = "PASSWORD")

    Advertisement
  3. The "installr" or "updateR" package will check for a new version of R, download it, and install it for you.
  4. 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.
  5. 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.
  6. "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.
  7. Advertisement
Method 2
Method 2 of 2:

Manual Update

PDF download Download Article
  1. 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.
  2. The installer will walk you through the process. If you have RStudio open, make sure to close it.
  3. 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.
  4. 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.
  5. 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)

  6. 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.

    versionpackageStatus()

  7. Advertisement

Expert Q&A

Ask a Question
      Advertisement

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!

      About This Article

      Thanks to all authors for creating a page that has been read 8,690 times.

      Is this article up to date?

      Advertisement