Complete remove and reinstall R, including all packages

Misconstruction picture Misconstruction · Jun 9, 2014 · Viewed 52.9k times · Source

After some heavy tinkering, I must have screwed up my R installation and some package permissions. Rather than try to fix it, I just want to wipe and reinstall everything. So I did:

sudo apt-get remove r-base-core
sudo apt-get remove r-base
sudo apt-get autoremove

Which did uninstall R, except when I reinstalled R, my old packages were still available (and some of them were causing troubles).

How can I do a complete reinstall, including removing all packages, except for the included base library?

Answer

Vincent Guyader picture Vincent Guyader · Jun 9, 2014

In R, you can use the .libPaths() instruction (or R -e '.libPaths()' in terminal) to know where your packages are installed. Delete those folders and reinstall.