Skip to content

Instantly share code, notes, and snippets.

@toebR
Created November 9, 2023 15:11
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 toebR/c96fd47b365e27c053605832d854f088 to your computer and use it in GitHub Desktop.
Save toebR/c96fd47b365e27c053605832d854f088 to your computer and use it in GitHub Desktop.
check libPath and add pkg to baseEnv
.libPaths
packages <- c("tidyverse",
"sf",
)
package.check <- lapply(
packages,
FUN = function(x) {
if (!require(x, character.only = TRUE)) {
install.packages(x, dependencies = TRUE)
library(x, character.only = TRUE)
}
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment