Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xinbinhuang/63d26c6f91d3e86c96fb7f62c024faf6 to your computer and use it in GitHub Desktop.
Save xinbinhuang/63d26c6f91d3e86c96fb7f62c024faf6 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