Skip to contents

Get variable information

Usage

get_var_info(x, key, field)

get_variable_class(x, key)

get_variable_label(x, key)

get_variable_source(x, key)

get_variable_description(x, key)

get_variable_type(x, key)

get_variable_module(x, key)

Arguments

x

[character(1)]

a variable name that is present in the variable column of key

key

[data.frame]

A data set with one row per variable and with columns that describe the variable. See nhanes_key for more details

field

[character(1)]

the column name in nhanes_key to get information from.

Value

a character value

Examples


# the low-level working function
get_var_info('bp_sys_mean', key = nhanes_key, field = 'class')
#> [1] "Blood pressure"

# the convenience functions
get_variable_class('bp_sys_mean')
#> [1] "Blood pressure"
get_variable_label('bp_sys_mean')
#> [1] "Systolic blood pressure (SBP), mm Hg"
get_variable_source('bp_sys_mean')
#> [1] "Derived"
get_variable_description('bp_sys_mean')
#> [1] "Mean systolic blood pressure in mm Hg. This is based on the average of up to 3 readings. Participants were required to have at least one reading. Overall, >95% of participants with at least one systolic blood pressure reading had three readings.  From 1999-2000 through 2015-2016, systolic blood pressure was measured using a mercury sphygmomanometer.  In 2017-2020, systolic blood pressure was measured using an oscillometric device.  The systolic blood pressure in 2017-2020 was calibrated to the mercury device by adding 1.5 mm Hg to the mean measured oscillometric value."
get_variable_module('bp_sys_mean')
#> [1] "htn"