Created
March 17, 2019 15:27
-
-
Save brianspiering/c56b3633afaf153bf9f608fd63665c60 to your computer and use it in GitHub Desktop.
Elegant loading of R packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup Packages --------------------------------------------------------------- | |
# List of packages for session | |
.packages <- c("devtools", "dplyr", "ggplot2", "markdown") | |
# Install CRAN packages (if not already installed) | |
.inst <- .packages %in% installed.packages() | |
if(length(.packages[!.inst]) > 0) install.packages(.packages[!.inst]) | |
# Load packages for session | |
lapply(.packages, require, character.only=TRUE) | |
cat("\014") # clear console | |
# TODO: support packages from GitHub | |
# install_github("cowsay", username="SChamberlain") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment