R Packages are installed to /usr/local/Cellar/r/3.1.2_1/R.framework/Versions/3.1/Resources/library
Whenever I run brew upgrade r
and the versio
Expanding on other answers by including packages from BioConductor as well as CRAN.
Before install: Backup current package list.
tmp <- installed.packages()
installedpkgs <- as.vector(tmp[is.na(tmp[,"Priority"]), 1])
save(installedpkgs, file="installed_old.rda")
Install new version of R
Reload packages 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()
Reload packages from BioConductor
chooseBioCmirror()
biocLite()
load("installed_old.rda")
tmp <- installed.packages()
installedpkgs.new <- as.vector(tmp[is.na(tmp[,"Priority"]), 1])
missing <- setdiff(installedpkgs, installedpkgs.new)
for (i in 1:length(missing)) biocLite(missing[i])
I put .libPaths("/Users/tim/.R/packages")
in my ~/.Rprofile
so that packages are installed to a path that doesn't disappear after a version bump.
Save a list of your packages as an R data file
tmp <- installed.packages() installedpkgs <- as.vector(tmp[is.na(tmp[,"Priority"]), 1]) save(installedpkgs, file="installed_old.rda")
Install new version
Load the list, then download the old packages from CRAN
oad("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()