Skip to content

Instantly share code, notes, and snippets.

@dholstius
Last active March 4, 2024 18:53
Show Gist options
  • Save dholstius/36f9e31c5835012fd69a9acc19ec39ea to your computer and use it in GitHub Desktop.
Save dholstius/36f9e31c5835012fd69a9acc19ec39ea to your computer and use it in GitHub Desktop.
Helping Yuanyuan migrate from R 4.1 to 4.3
old_pkgs <- dir("C:/Users/yfang/Documents/R/win-library/4.1")
for (pkg_name in old_pkgs) {
# If we already installed it, don't do anything
installed_pkgs <- row.names(installed.packages())
if (pkg_name %in% installed_pkgs) {
# pass
} else {
tryCatch(
pak::pkg_install(pkg_name),
error = function (e) warning(e))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment