Returns full NHANES codebook including Variable Name, SAS Label, English Text, Target, and Value distribution.
nhanesCodebook(nh_table, colname = NULL, dxa = FALSE)The codebook is returned as a list object. Returns NULL upon error.
Each NHANES variable has a codebook that provides a basic
description as well as the distribution or range of values. This
function returns the full codebook information for the selected
variable. If the environment variable NHANES_TABLE_BASE
was set during startup, the value of this variable is used as the
base URL instead of https://wwwn.cdc.gov (this allows the
use of a local or alternative mirror of the CDC documentation).
nhanesCodebook('AUX_D', 'AUQ020D')
#> $`Variable Name:`
#> [1] "AUQ020D"
#>
#> $`SAS Label:`
#> [1] "Earache Last 24 Hours, Left?"
#>
#> $`English Text:`
#> [1] "Have you had an earache in left ear in the last 24 hours?"
#>
#> $`Target:`
#> [1] "Both males and females 12 YEARS -\r 19 YEARS"
#>
#> $`Target:`
#> [1] "Both males and females 70 YEARS -\r 150 YEARS"
#>
#> $AUQ020D
#> # A tibble: 4 × 5
#> `Code or Value` `Value Description` Count Cumulative `Skip to Item`
#> <chr> <chr> <int> <int> <lgl>
#> 1 1 Yes (checkbox checked) 11 11 NA
#> 2 2 No (checkbox unchecked) 342 353 NA
#> 3 9 Don't know 1 354 NA
#> 4 . Missing 2680 3034 NA
#>
nhanesCodebook('BPX_J', 'BPACSZ')
#> $`Variable Name:`
#> [1] "BPACSZ"
#>
#> $`SAS Label:`
#> [1] "Coded cuff size"
#>
#> $`English Text:`
#> [1] "Cuff size (cm) (width X length)"
#>
#> $`Target:`
#> [1] "Both males and females 8 YEARS -\r 150 YEARS"
#>
#> $BPACSZ
#> # A tibble: 6 × 5
#> `Code or Value` `Value Description` Count Cumulative `Skip to Item`
#> <chr> <chr> <int> <int> <lgl>
#> 1 1 Infant (6X12) 0 0 NA
#> 2 2 Child (9X17) 408 408 NA
#> 3 3 Adult (12X22) 2245 2653 NA
#> 4 4 Large (15X32) 3123 5776 NA
#> 5 5 Thigh (18X35) 1036 6812 NA
#> 6 . Missing 1892 8704 NA
#>
bpx_code = nhanesCodebook('BPX_J')
length(bpx_code)
#> [1] 21