Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maciejmotyka/8b8662cdc3df9c0c280a6894fddfeffd to your computer and use it in GitHub Desktop.
Save maciejmotyka/8b8662cdc3df9c0c280a6894fddfeffd to your computer and use it in GitHub Desktop.
Load multiple packages at the same time in R
# library() or require() only load one package at a time
# but...
Packages <- c("dplyr", "ggplot2", "rstan", "readr")
lapply(Packages, library, character.only = TRUE)
# this loads as many as you put in 'Packages'. They need to be installed first, of course.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment