Last active
December 30, 2019 20:06
-
-
Save TheZetner/b4a76171959797e06807d0d865fbf0a3 to your computer and use it in GitHub Desktop.
Update R Packages on Windows After Updating R
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
# 1. Before you upgrade, build a temp file with all of your old packages. | |
tmp <- installed.packages() | |
installedpkgs <- as.vector(tmp[is.na(tmp[,"Priority"]), 1]) | |
save(installedpkgs, file="installed_old.rda") | |
# 2. Install the new version of R and let it do its thing. | |
# 3. Once you’ve got the new version up and running, reload the saved packages and re-install them from CRAN. | |
load("installed_old.rda") | |
tmp <- installed.packages() | |
installedpkgs.new <- as.vector(tmp[is.na(tmp[,"Priority"]), 1]) | |
missing <- setdiff(installedpkgs, installedpkgs.new) | |
install.packages(missing) | |
update.packages() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.r-bloggers.com/upgrade-r-without-losing-your-packages/