Updating Existing R Packages for A New Version of R

Recently, I upgraded to R 4.0.1. To avoid broken packages, I started updating installed packages using installed.packages() and install.packages(). This solution was less than ideal because, if a dependee package was not built for R 4.0.1, then the dependent package failed to build and install.

After some search, I stumbled on update.packages(pkgs, checkBuilt=T, ask=F) solution. While the documentation of update.packages says, “If checkBuilt is TRUE, a package built under an earlier major.minor version of R (e.g., 3.4) is considered to be ‘old’”, this command did not update the installed packages that were built for R 3.6.2 (according to the output of packageDescription function). I wonder if I am missing something here or if this is a bug.

Finally, I wrote the following R script to traversal the dependence graph of each installed package and updated the dependent packages in post-order. Look Ma, I am using graph algorithms to solve real problems :)

Hope you find the script useful!

Programming, experimenting, writing | Past: SWE, Researcher, Professor | Present: SWE

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store