Reinstall packages after updating R
When you change R version, you must reinstall manually all your installed packages.
# before to update
pkgins <- rownames(installed.packages())
save(pkgins, file = "pkgins.Rdata")
# after updating
load(file = "pkgins.Rdata")
for (pkg in pkgins[is.na(match(pkgins, rownames(installed.packages())))]) {
if (pkg %in% pkgins[is.na(match(pkgins, rownames(installed.packages())))]) {
install.packages(pkg)
}
}
The packages shown with:
pkgins[is.na(match(pkgins, rownames(installed.packages())))]
Are not available in CRAN or produced an error when installed with new version.
# before to update
pkgins <- rownames(installed.packages())
save(pkgins, file = "pkgins.Rdata")
# after updating
load(file = "pkgins.Rdata")
for (pkg in pkgins[is.na(match(pkgins, rownames(installed.packages())))]) {
if (pkg %in% pkgins[is.na(match(pkgins, rownames(installed.packages())))]) {
install.packages(pkg)
}
}
The packages shown with:
pkgins[is.na(match(pkgins, rownames(installed.packages())))]
Are not available in CRAN or produced an error when installed with new version.
Commentaires
Enregistrer un commentaire