Skip to content

Instantly share code, notes, and snippets.

@gomesfellipe
Created April 19, 2018 02:28
Show Gist options
  • Save gomesfellipe/699e7a174cded1aaeceadbbb7e9cef89 to your computer and use it in GitHub Desktop.
Save gomesfellipe/699e7a174cded1aaeceadbbb7e9cef89 to your computer and use it in GitHub Desktop.
packages = c('<package1>', '<package2>')
for (package in packages) {
if (!require(package, character.only=T, quietly=T)) {
install.packages(package)
library(package, character.only=T)
}
}
# Ref: https://stackoverflow.com/questions/5595512/what-is-the-difference-between-require-and-library?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment