
Compute Socioeconomic and Epidemiological Indicators
Source:R/sus_socio_compute_indicators.R
sus_socio_compute_indicators.RdComputes a set of standardised indicators from the columns already present
in a climasus_df object (typically the output of sus_census_join()).
Indicators span demographics, socioeconomic vulnerability, mortality,
morbidity, maternal-child health, and health-resource availability.
Column names from the census aggregation step (e.g. V003_sum) can be
mapped to the formula-space names expected by each indicator via
col_mapping.
Usage
sus_socio_compute_indicators(
df,
indicators = NULL,
col_mapping = list(),
confidence_level = 0.95,
add_ci = TRUE,
lang = "pt",
verbose = TRUE
)Arguments
- df
A
climasus_dfobject at stage>= "spatial". Typically the output ofsus_census_join().- indicators
Character vector of indicator IDs to compute. If
NULL(default), all indicators whose required columns are present indfare computed automatically. Usesus_socio_list_indicators()to inspect the full catalogue.- col_mapping
Named list mapping formula-space variable names to actual column names in
df. For example:list(pop_young = "pop_0_14_sum", total_hh = "V003_sum")Only mappings that override the defaults need to be specified.
- confidence_level
Numeric. Confidence level for Poisson / Binomial intervals. Default
0.95.- add_ci
Logical. If
TRUE(default), adds*_lowand*_highcolumns for indicators that support uncertainty quantification (Poisson for rates, Wilson score for proportions).- lang
Language for messages:
"pt"(default),"en","es".- verbose
Logical. Print progress messages. Default
TRUE.
Value
The input climasus_df with additional columns prefixed ind_:
ind_<id>— computed valueind_<id>_low/ind_<id>_high— confidence-interval bounds (only for Poisson/Binomial indicators whenadd_ci = TRUE)
sus_meta is updated to type = "indicators" with a history entry.
Details
Formula evaluation: each indicator formula is evaluated using
rlang::eval_tidy() against a named-list environment built from the
resolved column values, so no package-level NSE column names are needed.
Missing columns: if a requested indicator lacks required columns (after
applying col_mapping), a warning is emitted and the indicator is skipped.
The function never aborts due to missing columns.
Confidence intervals:
Poisson (Garwood exact): for event-count / population-at-risk rates (mortality, incidence, hospitalisation).
Binomial (Wilson score): for proportions (%, coverage indices).
None: for ratios with complex numerators or direct index values.
Examples
if (FALSE) { # \dontrun{
df_ind <- sus_socio_compute_indicators(
df_census,
indicators = c("dependency_ratio", "water_connection_rate"),
col_mapping = list(
pop_young = "pop_0_14_sum",
pop_elderly = "pop_65_plus_sum",
pop_working = "pop_15_64_sum",
hh_water = "V111_sum",
total_hh = "V003_sum"
)
)
} # }