Returns the direction-of-improvement ("better" or "worse") for one or
more variables in a survey design object or data frame. Variables with no
direction set return NA_character_.
Arguments
- x
A survey design object or
data.frame.- ...
<
tidy-select> Variables to query. If empty, returns direction for all columns ofx. Mutually exclusive withvariable.- variable
character. Variable name(s) — alternative to.... Mutually exclusive with....
Value
A named character vector. Unset variables return NA_character_.
Returns character(0) (named, zero-length) when all specified variables
are missing from x.
See also
set_higher_is() to set direction attributes
Other metadata:
classify_question_type(),
extract_metadata(),
extract_missing_codes(),
extract_question_preface(),
extract_reverse_coded(),
extract_sata(),
extract_universe(),
extract_val_labels(),
extract_var_label(),
extract_var_note(),
infer_question_prefaces(),
set_higher_is(),
set_missing_codes(),
set_question_preface(),
set_reverse_coded(),
set_sata(),
set_universe(),
set_val_labels(),
set_var_label(),
set_var_note(),
survey_metadata(),
survey_weighting_history()
Examples
d <- as_survey(nhanes_2017, ids = sdmvpsu, weights = wtint2yr,
strata = sdmvstra, nest = TRUE)
d <- set_higher_is(d, bpxsy1 = "worse")
extract_higher_is(d, bpxsy1)
#> bpxsy1
#> "worse"
extract_higher_is(d)
#> seqn sdmvpsu sdmvstra wtmec2yr wtint2yr ridstatr riagendr ridageyr
#> NA NA NA NA NA NA NA NA
#> ridreth3 indfmpir dmdeduc2 bpxsy1 bpxdi1 bpxpls
#> NA NA NA "worse" NA NA
