Finding packages after R and Rstudio upgrade

I upgraded both R and Rstudio, and now Rstudio can not find my previously installed packages.

Do I simply change the directory name that Rstudio looks for the packages, and if so how do I do this?

Or should I reinstall packages, and delete old versions?

Thank you.

This is related to R, not RStudio, if you are on windows, each R version gets its own package library, that is why the new version can't see your old packages.

After a major R update, you have to reinstall all packages anyway because binaries are compiled for a different R version, so even an update (with checkBuilt = TRUE) will actually reinstall all packages.

You can change the default library folder by setting your R_LIBS_SITE environmental variable on a .Reviron or .Rprofile file, for example:

# In a .Renviron file you can set it by adding a line like this one but with your desired library path
R_LIBS_SITE="C:\\Program Files\\R\\R-4.1.0\\library"

For a more detailed explanation, you can read this blog post

Thank you very much. Do I simply delete the entire folder that contains the older packages, or is there something in that folder I still need?

Yes, you can delete the old library folder safely.

Thank you.

Perhaps this should be an option in updating R.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.