Skip to content

Instantly share code, notes, and snippets.

@serverhorror
Created August 20, 2014 17:16
Show Gist options
  • Select an option

  • Save serverhorror/403a435376247a44748a to your computer and use it in GitHub Desktop.

Select an option

Save serverhorror/403a435376247a44748a to your computer and use it in GitHub Desktop.
R Upgrade of Packages between versions
# Install bioConductor in your new R installation
source("http://bioconductor.org/biocLite.R")
chooseBioCmirror()
biocLite()
# install missing R packages for bioConductor
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])
# install missing R 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()
# Get a list of installed R packages in the old installation
tmp <- installed.packages()
installedpkgs <- as.vector(tmp[is.na(tmp[,"Priority"]), 1])
save(installedpkgs, file="installed_old.rda")
@serverhorror
Copy link
Copy Markdown
Author

Untested as of yet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment