Skip to content

Instantly share code, notes, and snippets.

@fegue
Last active April 21, 2021 07:14
Show Gist options
  • Save fegue/ca2826add422cdce3cc67ef043045e9c to your computer and use it in GitHub Desktop.
Save fegue/ca2826add422cdce3cc67ef043045e9c to your computer and use it in GitHub Desktop.
[Install Maybe] R Script install packages that are not yet on computer #R #Rpackages
### INSTALL ALL LIBRARIES AND DEPENDENCIES #####
# this will only install the packages that are not already installed on your computer i.e. packages won't get updated
libs <- c(
)
## which packages are not yet installed?
libsInstalled <- installed.packages()[,1]
libsToInstall <- libs[!libs %in% libsInstalled]
## fix if CRANextra mirror is down and causes problems with installations
#options(repos = getOption("repos")["CRAN"])
## install
install.packages(libsToInstall)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment