Skip to contents

Sets variable labels for multiple variables at once using named arguments. All variable names must exist in the survey data.

Usage

set_variable_labels(x, ...)

Arguments

x

A survey design object.

...

Named arguments where the name is the variable (unquoted) and the value is the label string. Supports !!! list splicing for programmatic use.

Value

The modified survey object, invisibly.

Examples

d <- as_survey(nhanes_2017, ids = sdmvpsu, weights = wtint2yr,
               strata = sdmvstra, nest = TRUE)
d <- set_variable_labels(
  d,
  bpxsy1 = "Systolic BP, 1st reading (mm Hg)",
  bpxdi1 = "Diastolic BP, 1st reading (mm Hg)"
)

# Programmatic with list splicing
lbls <- list(bpxsy1 = "Systolic BP", bpxdi1 = "Diastolic BP")
d <- set_variable_labels(d, !!!lbls)