Imports raw data, cleans it, sets up the survey design, computes all indicators, generates publication-ready tables and plots, and optionally renders Word reports.

run_steps_pipeline(
  data_path,
  country_name = "Country Name",
  survey_year = 2024,
  age_min = 18,
  age_max = 69,
  output_dir = tempdir(),
  render_reports = TRUE,
  mapping_file = NULL
)

Arguments

data_path

Path to raw STEPS data file (CSV, Excel, Stata, or SPSS).

country_name

Country name for reports (default "Country Name").

survey_year

Survey year (default 2024).

age_min

Minimum age in years (default 18).

age_max

Maximum age in years (default 69).

output_dir

Directory for all outputs (default tempdir()).

render_reports

Logical; render Word documents? (default TRUE).

mapping_file

Optional path to a filled column mapping template (Excel or CSV). If provided, uses read_column_mapping() instead of auto-detection. See the template at system.file("templates", "column_mapping_template.xlsx", package = "stepssurvey").

Value

A list with elements:

raw_data

Original imported data frame

clean_data

Cleaned and recoded data

cols

Detected column mapping from detect_steps_columns()

design

survey::svydesign object

indicators

List of all computed indicator results by domain

key_indicators

Summary tibble of headline estimates

tables

List of flextable::flextable objects

plots

List of ggplot2::ggplot objects

config

Configuration list from steps_config()

Details

This is the main entry point for end-to-end STEPS analysis.

Examples

if (FALSE) { # \dontrun{
# Auto-detect columns
result <- run_steps_pipeline("data/raw/steps_data.csv",
                             country_name = "Senegal",
                             survey_year = 2023)
result$key_indicators
result$plots$overview

# Use a custom column mapping
result <- run_steps_pipeline("data/raw/steps_data.csv",
                             country_name = "Senegal",
                             survey_year = 2023,
                             mapping_file = "my_mapping.xlsx")
} # }