Skip to contents

Wraps survey::svydesign() with automatic detection of standard IHS weight, strata, and PSU columns from harmonised data.

Usage

ihs_svydesign(data, weight_col = NULL, strata_col = NULL, psu_col = NULL)

Arguments

data

A data.frame of harmonised IHS data.

weight_col

Character. Column name for survey weights. If NULL (default), auto-detected from standard IHS column names.

strata_col

Character. Column name for strata. If NULL (default), auto-detected.

psu_col

Character. Column name for PSU/cluster. If NULL (default), auto-detected.

Value

A survey.design2 object from the survey package.

Examples

if (FALSE) { # \dontrun{
  library(survey)
  dsgn <- ihs_svydesign(harmonised_data)
  survey::svymean(~rexp_cat01, dsgn, na.rm = TRUE)
} # }