Unable to install packages because R cannot remove prior installation of packages


I am trying to install packages on R (I have tried several) but I get this Error-message:

Error in install.packages : cannot remove prior installation of package ‘assertthat’

It is different packages that cannot be removed depending on the package I am trying to install.

When I try to remove the package I get this Error:

Removing package from ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library’
(as ‘lib’ is unspecified)
Error in remove.packages : there is no package called ‘assertthat’

I have also tried to delete the packages manually from the library.

System Information:

  • RStudio Edition: Desktop
  • RStudio Version: Version 1.3.1093
  • OS Version: Catalina
  • R Version: R 4.0.3 GUI 1.73 Catalina build (7892)

Thank you!

From Troubleshooting Guide: Using RStudio

Have you tried restarting RStudio? Have you removed the package from both the user-level library and the system-level library?