Calculates weighted proportions (as percentages) with 95% confidence intervals for a yes/no variable, optionally stratified by a grouping variable.
svyprop(formula, design, by = NULL, na.rm = TRUE)A formula (e.g., ~variable or using binary variables).
A survey design object (from setup_survey_design()).
Optional formula for stratification (e.g., ~sex).
Logical; if TRUE (default), omit NA values.
A data frame with columns:
estimate: estimated proportion (%)
lower: 95% CI lower bound (%)
upper: 95% CI upper bound (%)
se: standard error (%)
If by is specified: grouping column(s) prepended