Skip to contents

Creates the domain-numbered data-pipeline layout this package is built around (01_data/ domains, 02_scripts/, 03_outputs/). Writes a .Rprofile that defines cfg, a .gitignore, and starter 2a_download_data.R / 2b_process_data.R scripts. Before running the scripts, install their required packages, set a POLIS API key and supply the WHO polio GDB layers in 01_data/1a_shapefiles/raw/. The scripts download POLIS and WorldPop data, process boundaries, extract population estimates and run run_pipeline().

Usage

init_polis_pipeline(
  root,
  regions = "EMRO",
  start_year = 2020,
  pop_years = 2010:2027,
  pop_source = c("reconciled", "polis", "worldpop"),
  domains = c("shapefiles", "population", "polis", "vaccination"),
  write_rprofile = TRUE,
  write_scripts = TRUE,
  gitignore = TRUE,
  overwrite = FALSE,
  renv = FALSE,
  quiet = FALSE
)

Arguments

root

Path to the project root (created recursively if absent).

regions

WHO region codes the pipeline is scoped to, written into the generated cfg. Default "EMRO".

start_year

Earliest onset/collection year to retain. Default 2020.

pop_years

Calendar years for the population / WorldPop step. Default 2010:2027.

pop_source

Population denominator preference for polis_config(), one of "reconciled", "polis", "worldpop". Default "reconciled".

domains

Which 01_data domains to create: any of "shapefiles", "population", "polis", "vaccination". Default all four.

write_rprofile, write_scripts, gitignore

Whether to write the project .Rprofile, the starter 02_scripts/, and the .gitignore. Default TRUE.

overwrite

Overwrite .Rprofile / scripts / .gitignore that already exist. Default FALSE – existing files are kept (and skipped with a note), so re-running on a live project never clobbers it. Directory creation is always idempotent.

renv

Set up renv in the project for reproducible package versions. When TRUE (and the optional renv package is installed) the scaffold runs renv::scaffold() – writing renv/activate.R, a starter renv.lock, and wiring the generated .Rprofile to load it – so a later renv::snapshot() pins your versions and collaborators reproduce them with renv::restore(). Default FALSE.

quiet

Suppress the success message. Default FALSE.

Value

Invisibly, a list with root and the absolute dirs created.

Details

Distinct from init_polis_project(), which scaffolds a lighter generic raw/processed/validation/cache/logs layout.

Examples

proj <- init_polis_pipeline(
  file.path(tempdir(), "polio_pipeline"), regions = "EMRO", quiet = TRUE
)
file.exists(file.path(proj$root, ".Rprofile"))
#> [1] TRUE