Skip to content

Instantly share code, notes, and snippets.

@stevecondylios
Created January 18, 2020 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevecondylios/edc66af836beab93db54f35664376d60 to your computer and use it in GitHub Desktop.
Save stevecondylios/edc66af836beab93db54f35664376d60 to your computer and use it in GitHub Desktop.
# init.R
#
# Example R code to install packages if not already installed
#
my_packages = c("tidyverse", "shiny")
install_if_missing = function(p) {
if (p %in% rownames(installed.packages()) == FALSE) {
install.packages(p)
}
}
invisible(sapply(my_packages, install_if_missing))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment