Skip to contents

Sets the variable label for a single variable in a survey design object.

Usage

set_var_label(x, var, label)

Arguments

x

A survey design object.

var

<data-masked> Variable to label (bare, unquoted).

label

A character string. The variable label to assign.

Value

The modified survey object, invisibly.

Examples

d <- as_survey(nhanes_2017, ids = sdmvpsu, weights = wtint2yr,
               strata = sdmvstra, nest = TRUE)
d <- set_var_label(d, indfmpir, "Income-to-poverty ratio")

# Pipe-friendly
d <- d |> set_var_label(bpxsy1, "Systolic BP (1st reading)")