Sets the variable label for a single variable in a survey design object.
Arguments
- x
A survey design object.
- var
<
data-masked> Variable to label (bare, unquoted).- label
A character string. The variable label to assign.
See also
set_variable_labels() for setting multiple labels at once,
extract_var_label() to retrieve a label
Other metadata:
extract_question_preface(),
extract_val_labels(),
extract_var_label(),
extract_var_note(),
infer_question_prefaces(),
set_question_preface(),
set_question_prefaces(),
set_val_labels(),
set_value_labels(),
set_var_note(),
set_variable_labels(),
set_variable_notes(),
survey_metadata(),
survey_weighting_history()
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)")