Wire local-only data setup workflow

This commit is contained in:
aseimel
2026-06-15 14:38:47 +02:00
parent b5ca9370f1
commit d9c648bd54
21 changed files with 2442 additions and 110 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env Rscript
repo_root <- normalizePath(getwd(), mustWork = TRUE)
lib <- Sys.getenv("R_LIBS_USER", file.path(repo_root, "_local", "R", "library"))
dir.create(lib, recursive = TRUE, showWarnings = FALSE)
.libPaths(c(lib, .libPaths()))
required <- c("tidyverse", "countrycode", "haven", "foreign")
missing <- required[!vapply(required, requireNamespace, quietly = TRUE, FUN.VALUE = logical(1))]
if (length(missing) > 0) {
message("Installing missing R packages into ", lib, ": ", paste(missing, collapse = ", "))
install.packages(missing, repos = "https://cloud.r-project.org", lib = lib)
} else {
message("R data-setup dependencies already available")
}