Last active
March 4, 2024 18:53
-
-
Save dholstius/36f9e31c5835012fd69a9acc19ec39ea to your computer and use it in GitHub Desktop.
Helping Yuanyuan migrate from R 4.1 to 4.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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