Created
August 19, 2012 13:31
-
-
Save reinholdsson/3394814 to your computer and use it in GitHub Desktop.
Install and/or load packages (add to the munge folder in ProjectTemplate)
This file contains 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
load_packages <- function(pkgs, repo = "http://ftp.sunet.se/pub/lang/CRAN/"){ | |
invisible(lapply(pkgs, function(pkg) { | |
req <- function(x) require(x, character.only = TRUE) | |
if(!suppressWarnings(req(pkg))){ | |
install.packages(pkg, repos = repo) | |
req(pkg) | |
} | |
})) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment