Skip to content

Instantly share code, notes, and snippets.

@cgpu
Created September 13, 2018 08:26
Show Gist options
  • Select an option

  • Save cgpu/ae08fad1d2c12a8cf0145aa027d6bb1f to your computer and use it in GitHub Desktop.

Select an option

Save cgpu/ae08fad1d2c12a8cf0145aa027d6bb1f to your computer and use it in GitHub Desktop.
From a list of R packages, check which aren't installed, do install them.
# Stack gem here: https://stackoverflow.com/questions/4090169/elegant-way-to-check-for-missing-packages-and-install-them
list.of.packages <- c("ggplot2", "Rcpp")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment