Last active
May 20, 2020 11:01
-
-
Save b-kennedy0/f534d4acc407f37b8a2e99f8ad2b0f53 to your computer and use it in GitHub Desktop.
Tidy code that will: (1) state which packages are required (2) list which ones aren’t already installed. (3) install the new packages. (4) load (library) them. (5) check for updates for all packages.
This file contains 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
list_of_packages<-c("tidyr","psych","ggplot2","here") | |
new.packages <- list_of_packages[!(list_of_packages %in% installed.packages()[,"Package"])] | |
if(length(new.packages))install.packages(new.packages) | |
lapply(list_of_packages, library, character.only = TRUE) | |
update.packages(ask=FALSE, repos = "https://cloud.r-project.org") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment