Last active
August 29, 2015 14:24
-
-
Save ZeccaLehn/acfbe4908148052b9e67 to your computer and use it in GitHub Desktop.
[R] Load and Reload Libraries after Restart with runLib().
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
packages <- c("data.table", "dplyr", "doParallel") # List of libraries | |
runLib <- function(packages = packages) { | |
packagesCheck <- packages[!(packages %in% installed.packages()[,"Package"])] | |
if(length(packagesCheck)) {install.packages(packagesCheck)}; rm(packagesCheck) | |
lapply(packages, function(x) {do.call("require", list(x))}) | |
} | |
runLib(packages) # Rerun this line after RESTART in R and add packages as needed | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment