How can I remove all installed packages except base
and recommended
?
From the R terminal enter the command remove. packages("package-to-remove") to remove or uninstall the package from R environment.
To see what packages are installed, use the installed. packages() command. This will return a matrix with a row for each package that has been installed.
Be CAREFUL! And read the docs before you try this:
# Pasted as a commented to prevent blindly copying and pasting # remove.packages( installed.packages( priority = "NA" )[,1] )
By default this will remove packages from the first library in your .libPaths()
.
Instead of
Updated to R 3.0.0 and have to rebuild all packages.
just do
update.packages(..., checkBuilt=TRUE)
which is what I did on my R 3.0.0 (using lib.loc=...
to point to my different local directories). This will update everything you have and which it can still get from repos such as CRAN. For install_git()
etc, you are out of luck and need to reinstall.
But either way you do not need to remove the packages first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With