Skip to content

Instantly share code, notes, and snippets.

@messefor
Created November 5, 2016 08:18
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 messefor/72a8dfbf90088ddc29ebad9ae4b06bda to your computer and use it in GitHub Desktop.
Save messefor/72a8dfbf90088ddc29ebad9ae4b06bda to your computer and use it in GitHub Desktop.
# sample of checking package installed and load all.
required.pckg <-
c(
'dummies',
'tidyverse',
'glmnet'
)
not.installed <- !(required.pckg %in% installed.packages()[,'Package'])
if (any(not.installed)) {
install.packages(required.pckg[not.installed])
}
sapply(required.pckg, require, character.only = TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment