Last active
July 17, 2017 16:06
-
-
Save sahilseth/5dcc71cf2b563edca9b56e2d920543be to your computer and use it in GitHub Desktop.
Re-install R packages
This file contains hidden or 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
#source("https://gist.githubusercontent.com/sahilseth/5dcc71cf2b563edca9b56e2d920543be/raw/re_install_r_pkgs.R") | |
pkgs = unlist(read.table("~/Dropbox/misc/Rpkgs.txt", stringsAsFactors = FALSE)) | |
# idea1 (works) | |
ins = installed.packages()[, 1] | |
need_pkgs = pkgs[which(is.na(match(pkgs, ins)))] | |
length(need_pkgs) | |
need_pkgs | |
source("https://bioconductor.org/biocLite.R") | |
biocLite("BiocInstaller") | |
for(pkg in need_pkgs){ | |
# does not re-install uneccesarily | |
ins = installed.packages()[, 1] | |
need_pkgs = pkgs[which(is.na(match(pkgs, ins)))] | |
install.packages(pkg) | |
# if pkg does not install | |
if(!pkg %in% installed.packages()[, 1]) | |
BiocInstaller::biocLite(pkg) | |
} | |
gh_pkgs = c(#"mikelove/tximport", | |
"thertrader/fidlr", # fin data loader | |
"statwonk/openNHTSA", | |
"hadley/pkgdown", | |
#"parklab/nozzle", | |
"dgrtwo/gganimate") | |
for(pkg in gh_pkgs){ | |
# does not re-install uneccesarily | |
ins = installed.packages()[, 1] | |
gh_pkgs = gh_pkgs[which(is.na(match(gh_pkgs, ins)))] | |
pacman::p_install_gh(pkg) | |
} | |
# some packages need linux pkgs installed | |
# need TTR etc need gfortran, from: https://gcc.gnu.org/wiki/GFortranBinaries#MacOS | |
# sudo apt-get install libudunits2-dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment