Returns a summary of all metadata fields for one or more variables in a survey design object or data frame. Useful for auditing metadata state or building codebooks.
Arguments
- x
A survey design object or
data.frame.- ...
<
data-masked> Variable names (bare, unquoted). If empty, all variables are included.- fill
NULL(default) or"include".NULLomits variables that have no metadata in any field;"include"returns all variables regardless.
Value
A named list. Each entry is a named list with keys:
variable_label, value_labels, question_preface, note,
universe, missing_codes, transformations.
See also
Other metadata:
extract_missing_codes(),
extract_question_preface(),
extract_universe(),
extract_val_labels(),
extract_var_label(),
extract_var_note(),
infer_question_prefaces(),
set_missing_codes(),
set_question_preface(),
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_universe(d, ridageyr = "All participants 0+")
extract_metadata(d, ridageyr)
#> $ridageyr
#> $ridageyr$variable_label
#> [1] "Age in years at screening"
#>
#> $ridageyr$value_labels
#> NULL
#>
#> $ridageyr$question_preface
#> NULL
#>
#> $ridageyr$note
#> NULL
#>
#> $ridageyr$universe
#> [1] "All participants 0+"
#>
#> $ridageyr$missing_codes
#> NULL
#>
#> $ridageyr$transformations
#> list()
#>
#>
extract_metadata(d, fill = "include")
#> $seqn
#> $seqn$variable_label
#> [1] "Respondent sequence number"
#>
#> $seqn$value_labels
#> NULL
#>
#> $seqn$question_preface
#> NULL
#>
#> $seqn$note
#> NULL
#>
#> $seqn$universe
#> NULL
#>
#> $seqn$missing_codes
#> NULL
#>
#> $seqn$transformations
#> list()
#>
#>
#> $sdmvpsu
#> $sdmvpsu$variable_label
#> [1] "Masked variance pseudo-PSU"
#>
#> $sdmvpsu$value_labels
#> NULL
#>
#> $sdmvpsu$question_preface
#> NULL
#>
#> $sdmvpsu$note
#> NULL
#>
#> $sdmvpsu$universe
#> NULL
#>
#> $sdmvpsu$missing_codes
#> NULL
#>
#> $sdmvpsu$transformations
#> list()
#>
#>
#> $sdmvstra
#> $sdmvstra$variable_label
#> [1] "Masked variance pseudo-stratum"
#>
#> $sdmvstra$value_labels
#> NULL
#>
#> $sdmvstra$question_preface
#> NULL
#>
#> $sdmvstra$note
#> NULL
#>
#> $sdmvstra$universe
#> NULL
#>
#> $sdmvstra$missing_codes
#> NULL
#>
#> $sdmvstra$transformations
#> list()
#>
#>
#> $wtmec2yr
#> $wtmec2yr$variable_label
#> [1] "Full sample 2 year MEC exam weight"
#>
#> $wtmec2yr$value_labels
#> NULL
#>
#> $wtmec2yr$question_preface
#> NULL
#>
#> $wtmec2yr$note
#> NULL
#>
#> $wtmec2yr$universe
#> NULL
#>
#> $wtmec2yr$missing_codes
#> NULL
#>
#> $wtmec2yr$transformations
#> list()
#>
#>
#> $wtint2yr
#> $wtint2yr$variable_label
#> [1] "Full sample 2 year interview weight"
#>
#> $wtint2yr$value_labels
#> NULL
#>
#> $wtint2yr$question_preface
#> NULL
#>
#> $wtint2yr$note
#> NULL
#>
#> $wtint2yr$universe
#> NULL
#>
#> $wtint2yr$missing_codes
#> NULL
#>
#> $wtint2yr$transformations
#> list()
#>
#>
#> $ridstatr
#> $ridstatr$variable_label
#> [1] "Interview/Examination status"
#>
#> $ridstatr$value_labels
#> NULL
#>
#> $ridstatr$question_preface
#> NULL
#>
#> $ridstatr$note
#> NULL
#>
#> $ridstatr$universe
#> NULL
#>
#> $ridstatr$missing_codes
#> NULL
#>
#> $ridstatr$transformations
#> list()
#>
#>
#> $riagendr
#> $riagendr$variable_label
#> [1] "Gender"
#>
#> $riagendr$value_labels
#> NULL
#>
#> $riagendr$question_preface
#> NULL
#>
#> $riagendr$note
#> NULL
#>
#> $riagendr$universe
#> NULL
#>
#> $riagendr$missing_codes
#> NULL
#>
#> $riagendr$transformations
#> list()
#>
#>
#> $ridageyr
#> $ridageyr$variable_label
#> [1] "Age in years at screening"
#>
#> $ridageyr$value_labels
#> NULL
#>
#> $ridageyr$question_preface
#> NULL
#>
#> $ridageyr$note
#> NULL
#>
#> $ridageyr$universe
#> [1] "All participants 0+"
#>
#> $ridageyr$missing_codes
#> NULL
#>
#> $ridageyr$transformations
#> list()
#>
#>
#> $ridreth3
#> $ridreth3$variable_label
#> [1] "Race/Hispanic origin w/ NH Asian"
#>
#> $ridreth3$value_labels
#> NULL
#>
#> $ridreth3$question_preface
#> NULL
#>
#> $ridreth3$note
#> NULL
#>
#> $ridreth3$universe
#> NULL
#>
#> $ridreth3$missing_codes
#> NULL
#>
#> $ridreth3$transformations
#> list()
#>
#>
#> $indfmpir
#> $indfmpir$variable_label
#> [1] "Ratio of family income to poverty"
#>
#> $indfmpir$value_labels
#> NULL
#>
#> $indfmpir$question_preface
#> NULL
#>
#> $indfmpir$note
#> NULL
#>
#> $indfmpir$universe
#> NULL
#>
#> $indfmpir$missing_codes
#> NULL
#>
#> $indfmpir$transformations
#> list()
#>
#>
#> $dmdeduc2
#> $dmdeduc2$variable_label
#> [1] "Education level - Adults 20+"
#>
#> $dmdeduc2$value_labels
#> NULL
#>
#> $dmdeduc2$question_preface
#> NULL
#>
#> $dmdeduc2$note
#> NULL
#>
#> $dmdeduc2$universe
#> NULL
#>
#> $dmdeduc2$missing_codes
#> NULL
#>
#> $dmdeduc2$transformations
#> list()
#>
#>
#> $bpxsy1
#> $bpxsy1$variable_label
#> [1] "Systolic: Blood pres (1st rdg) mm Hg"
#>
#> $bpxsy1$value_labels
#> NULL
#>
#> $bpxsy1$question_preface
#> NULL
#>
#> $bpxsy1$note
#> NULL
#>
#> $bpxsy1$universe
#> NULL
#>
#> $bpxsy1$missing_codes
#> NULL
#>
#> $bpxsy1$transformations
#> list()
#>
#>
#> $bpxdi1
#> $bpxdi1$variable_label
#> [1] "Diastolic: Blood pres (1st rdg) mm Hg"
#>
#> $bpxdi1$value_labels
#> NULL
#>
#> $bpxdi1$question_preface
#> NULL
#>
#> $bpxdi1$note
#> NULL
#>
#> $bpxdi1$universe
#> NULL
#>
#> $bpxdi1$missing_codes
#> NULL
#>
#> $bpxdi1$transformations
#> list()
#>
#>
#> $bpxpls
#> $bpxpls$variable_label
#> [1] "60 sec. pulse (30 sec. pulse * 2)"
#>
#> $bpxpls$value_labels
#> NULL
#>
#> $bpxpls$question_preface
#> NULL
#>
#> $bpxpls$note
#> NULL
#>
#> $bpxpls$universe
#> NULL
#>
#> $bpxpls$missing_codes
#> NULL
#>
#> $bpxpls$transformations
#> list()
#>
#>
