Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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
You can’t perform that action at this time.