Skip to content

Instantly share code, notes, and snippets.

@mhkeller
Created March 20, 2019 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhkeller/25acc5da93cdfa88c9c900ee08825db9 to your computer and use it in GitHub Desktop.
Save mhkeller/25acc5da93cdfa88c9c900ee08825db9 to your computer and use it in GitHub Desktop.
Loading some sweet R packages
pkgs <- c("packages")
check <- sapply(pkgs, require, warn.conflicts = TRUE, character.only = TRUE)
if(any(!check)) {
pkgs.missing <- pkgs[!check]
install.packages(pkgs.missing)
check <- sapply(pkgs.missing, require, warn.conflicts = TRUE, character.only = TRUE)
}
rm(pkgs, check)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment