Skip to content

Instantly share code, notes, and snippets.

@yulijia
Created December 29, 2017 00:40
Show Gist options
  • Save yulijia/3f11b8e20084ed5053153c1d6ee8bd54 to your computer and use it in GitHub Desktop.
Save yulijia/3f11b8e20084ed5053153c1d6ee8bd54 to your computer and use it in GitHub Desktop.
old.packages <- list.files("/R/x86_64-redhat-linux-gnu-library/3.3")
source("https://bioconductor.org/biocLite.R")
# Install packages in the previous version.
# For each package p in previous version...
for (p in old.packages[!grepl("LOCK",old.packages)]) {
# ... Only if p is not already installed
if (!(p %in% installed.packages()[,"Package"])) {
# Install p
# print(p)
install.packages(p)
if(!library(p,character.only = T,logical.return = T)){
biocLite(p)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment