How to Uninstall R and All Its Packages on Windows

Jesse John Feb 02, 2024
  1. Paths to R Package Libraries
  2. Uninstall R Packages Using R Studio
  3. Uninstall R on Windows
  4. Delete the R Library Folders
  5. Uninstall Other Software
  6. Conclusion
How to Uninstall R and All Its Packages on Windows

Unlike most other software, uninstalling R does not remove it completely. Section 2.7 of R for Windows FAQ states that uninstallation of R only removes files from the original installation, not the packages and other subsequently installed files.

This article shows how to uninstall R and all its packages on Windows.

Paths to R Package Libraries

R packages are installed in folders that R calls libraries. In most cases, there may be more than one library folder.

We can run the .libPaths() command to see the folders that R uses as libraries on our computer. Note the dot and the capital P in the command.

R will return the paths to one or more folders. Copy and save the paths to all the folders. We will use these paths in the last step.

Uninstall R Packages Using R Studio

We can use the Packages pane at the bottom-right of the R Studio interface to uninstall all the add-on R packages. The packages are classified into User Library and System Library.

Click the cross mark at the extreme right of each package name to uninstall it.

Repeat this for each package in both categories. Some packages in the System Library do not have a cross mark; we cannot uninstall these using this pane.

Uninstall R on Windows

There are two ways to uninstall R. (See Section 2.7 of the R for Windows FAQ linked above.)

  1. Use the Windows instructions for uninstalling any program. In most cases, we will use the Control Panel for this purpose.
  2. Locate the unins000.exe file in the R installation folder, and run it.

Delete the R Library Folders

We uninstalled most R Packages as the first step in uninstalling R. We then uninstalled R itself.

Despite these two actions, the R library folders may still be present. They may contain sub-folders and files that could not get deleted.

We can safely delete these folders at this stage.

We had saved the paths to the R library folders. Locate each of those folders in the Windows File Explorer and delete it.

This completes the uninstallation of R and all its packages.

Uninstall Other Software

After uninstalling R and its packages, we can uninstall other related software that we may have installed if we no longer need them. These include R Studio and the Rtools software.

Both these can be uninstalled like any other Windows software.

Conclusion

R derives most of its power from its package system. Uninstalling R does not remove the packages.

Following the steps given above, we will be able to identify R library folders, uninstall add-on packages, uninstall R, delete R library folders and, if no longer needed, uninstall other R-related software as well.

Author: Jesse John
Jesse John avatar Jesse John avatar

Jesse is passionate about data analysis and visualization. He uses the R statistical programming language for all aspects of his work.