Last active
August 29, 2015 13:56
-
-
Save brianspiering/9027330 to your computer and use it in GitHub Desktop.
Automatically check and install packages in R
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