Skip to content

Commit

Permalink
added check_packages.R script
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronGullickson committed Sep 13, 2019
1 parent b073565 commit 556090d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions check_packages.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## check_packages.R

#Run this script to check for packages that the other R scripts will use. If missing, try to install.
#code borrowed from here:
#http://www.vikram-baliga.com/blog/2015/7/19/a-hassle-free-way-to-verify-that-r-packages-are-installed-and-loaded

#add new packages to the chain here
packages = c("xml2","rlist","here","magrittr","ggplot2","dplyr","tibble","stringr","readr",
"googlesheets","htmltab","DiagrammeR","wrswoR","reshape2")

package.check <- lapply(packages, FUN = function(x) {
if (!require(x, character.only = TRUE)) {
install.packages(x, dependencies = TRUE)
library(x, character.only = TRUE)
}
})

0 comments on commit 556090d

Please sign in to comment.