Computes a per-variable summary of a NHANES table either using the actual data or its corresponding codebook
nhanesTableSummary(nh_table, use = c("data", "codebook", "both"), ...)
the name of a valid NHANES table
character string, whether to create a summary from the
data itself or the codebook, which respectively use either the
NHANES SAS data files or the HTML documentation files. If
use = "both"
then both are computed and merged; additional
arguments (...
) are ignored in this case.
additional arguments, usually passed on to either
nhanes
or nhanesCodebook
as
appropriate. Alternatively, the src
argument can be used
to pass on an already available data frame or codebook, but this
must be consistent with the use
argument.
A data frame with one row per variable, with columns
depending on the value of the use
argument.
This function computes useful summaries of each variable included
in the specified NHANES table. The resulting data frame contains
one row for each variable in the table, and includes summary
measures that indicate the total number of observations, the
number of missing observations, whether the variable is most
likely numeric or categorical, whether the variable is related to
skipping other variables, etc. The precise details depend on the
use
argument and are subject to change.
nhanesTableSummary('DEMO_D', use = "data")
#> table varname nobs_data na_data size num cat unique
#> 1 DEMO_D SEQN 10348 0 82832 bytes TRUE FALSE TRUE
#> 2 DEMO_D SDDSRVYR 10348 0 41912 bytes FALSE TRUE FALSE
#> 3 DEMO_D RIDSTATR 10348 0 42016 bytes FALSE TRUE FALSE
#> 4 DEMO_D RIDEXMON 10348 398 42000 bytes FALSE TRUE FALSE
#> 5 DEMO_D RIAGENDR 10348 0 41952 bytes FALSE TRUE FALSE
#> 6 DEMO_D RIDAGEYR 10348 0 82832 bytes TRUE FALSE FALSE
#> 7 DEMO_D RIDAGEMN 10348 170 82832 bytes TRUE FALSE FALSE
#> 8 DEMO_D RIDAGEEX 10348 571 82832 bytes TRUE FALSE FALSE
#> 9 DEMO_D RIDRETH1 10348 0 42272 bytes FALSE TRUE FALSE
#> 10 DEMO_D DMQMILIT 10348 4508 42024 bytes FALSE TRUE FALSE
#> 11 DEMO_D DMDBORN 10348 0 42136 bytes FALSE TRUE FALSE
#> 12 DEMO_D DMDCITZN 10348 0 42152 bytes FALSE TRUE FALSE
#> 13 DEMO_D DMDYRSUS 10348 8800 42792 bytes FALSE TRUE FALSE
#> 14 DEMO_D DMDEDUC3 10348 6916 43232 bytes FALSE TRUE FALSE
#> 15 DEMO_D DMDEDUC2 10348 5369 42456 bytes FALSE TRUE FALSE
#> 16 DEMO_D DMDSCHOL 10348 7164 42128 bytes FALSE TRUE FALSE
#> 17 DEMO_D DMDMARTL 10348 3650 42392 bytes FALSE TRUE FALSE
#> 18 DEMO_D DMDHHSIZ 10348 0 82832 bytes TRUE FALSE FALSE
#> 19 DEMO_D DMDFMSIZ 10348 0 82832 bytes TRUE FALSE FALSE
#> 20 DEMO_D INDHHINC 10348 132 43080 bytes FALSE TRUE FALSE
#> 21 DEMO_D INDFMINC 10348 110 43080 bytes FALSE TRUE FALSE
#> 22 DEMO_D INDFMPIR 10348 534 82832 bytes TRUE FALSE FALSE
#> 23 DEMO_D RIDEXPRG 10348 6975 42208 bytes FALSE TRUE FALSE
#> 24 DEMO_D DMDHRGND 10348 0 41952 bytes FALSE TRUE FALSE
#> 25 DEMO_D DMDHRAGE 10348 0 82832 bytes TRUE FALSE FALSE
#> 26 DEMO_D DMDHRBRN 10348 323 42216 bytes FALSE TRUE FALSE
#> 27 DEMO_D DMDHREDU 10348 322 42456 bytes FALSE TRUE FALSE
#> 28 DEMO_D DMDHRMAR 10348 333 42392 bytes FALSE TRUE FALSE
#> 29 DEMO_D DMDHSEDU 10348 4794 42456 bytes FALSE TRUE FALSE
#> 30 DEMO_D SIALANG 10348 2 41952 bytes FALSE TRUE FALSE
#> 31 DEMO_D SIAPROXY 10348 2 41952 bytes FALSE TRUE FALSE
#> 32 DEMO_D SIAINTRP 10348 2 41952 bytes FALSE TRUE FALSE
#> 33 DEMO_D FIALANG 10348 113 41952 bytes FALSE TRUE FALSE
#> 34 DEMO_D FIAPROXY 10348 113 41952 bytes FALSE TRUE FALSE
#> 35 DEMO_D FIAINTRP 10348 113 41952 bytes FALSE TRUE FALSE
#> 36 DEMO_D MIALANG 10348 3212 41952 bytes FALSE TRUE FALSE
#> 37 DEMO_D MIAPROXY 10348 3212 41952 bytes FALSE TRUE FALSE
#> 38 DEMO_D MIAINTRP 10348 3212 41952 bytes FALSE TRUE FALSE
#> 39 DEMO_D AIALANG 10348 3023 41952 bytes FALSE TRUE FALSE
#> 40 DEMO_D WTINT2YR 10348 0 82832 bytes TRUE FALSE FALSE
#> 41 DEMO_D WTMEC2YR 10348 0 82832 bytes TRUE FALSE FALSE
#> 42 DEMO_D SDMVPSU 10348 0 82832 bytes TRUE FALSE FALSE
#> 43 DEMO_D SDMVSTRA 10348 0 82832 bytes TRUE FALSE FALSE
nhanesTableSummary('DEMO_D', use = "codebook")
#> table varname label nobs_cb na_cb
#> 1 DEMO_D SEQN Respondent sequence number NA NA
#> 2 DEMO_D SDDSRVYR Data Release Number 10348 0
#> 3 DEMO_D RIDSTATR Interview/Examination Status 10348 0
#> 4 DEMO_D RIDEXMON Six month time period 10348 398
#> 5 DEMO_D RIAGENDR Gender 10348 0
#> 6 DEMO_D RIDAGEYR Age at Screening Adjudicated - Recode 10348 0
#> 7 DEMO_D RIDAGEMN Age in Months - Recode 10348 170
#> 8 DEMO_D RIDAGEEX Exam Age in Months - Recode 10348 571
#> 9 DEMO_D RIDRETH1 Race/Ethnicity - Recode 10348 0
#> 10 DEMO_D DMQMILIT Veteran/Military Status 10348 4508
#> 11 DEMO_D DMDBORN Country of Birth - Recode 10348 0
#> 12 DEMO_D DMDCITZN Citizenship Status 10348 0
#> 13 DEMO_D DMDYRSUS Length of time in US 10348 8800
#> 14 DEMO_D DMDEDUC3 Education Level - Children/Youth 6-19 10348 6916
#> 15 DEMO_D DMDEDUC2 Education Level - Adults 20+ 10348 5369
#> 16 DEMO_D DMDSCHOL Now attending school? 10348 7164
#> 17 DEMO_D DMDMARTL Marital Status 10348 3650
#> 18 DEMO_D DMDHHSIZ Total number of people in the Household 10348 0
#> 19 DEMO_D DMDFMSIZ Total number of people in the Family 10348 0
#> 20 DEMO_D INDHHINC Annual Household Income 10348 132
#> 21 DEMO_D INDFMINC Annual Family Income 10348 110
#> 22 DEMO_D INDFMPIR Family PIR 10348 534
#> 23 DEMO_D RIDEXPRG Pregnancy Status at Exam - Recode 10348 6975
#> 24 DEMO_D DMDHRGND HH Ref Person Gender 10348 0
#> 25 DEMO_D DMDHRAGE HH Ref Person Age 10348 0
#> 26 DEMO_D DMDHRBRN HH Ref Person Country of Birth 10348 323
#> 27 DEMO_D DMDHREDU HH Ref Person Education Level 10348 322
#> 28 DEMO_D DMDHRMAR HH Ref Person Marital Status 10348 333
#> 29 DEMO_D DMDHSEDU HH Ref Person's Spouse Education Level 10348 4794
#> 30 DEMO_D SIALANG Language of SP Interview 10348 2
#> 31 DEMO_D SIAPROXY Proxy used in SP Interview? 10348 2
#> 32 DEMO_D SIAINTRP Interpreter used in SP Interview? 10348 2
#> 33 DEMO_D FIALANG Language of Family Interview 10348 113
#> 34 DEMO_D FIAPROXY Proxy used in Family Interview? 10348 113
#> 35 DEMO_D FIAINTRP Interpreter used in Family Interview? 10348 113
#> 36 DEMO_D MIALANG Language of MEC Interview 10348 3212
#> 37 DEMO_D MIAPROXY Proxy used in MEC Interview? 10348 3212
#> 38 DEMO_D MIAINTRP Interpreter used in MEC Interview? 10348 3212
#> 39 DEMO_D AIALANG Language of ACASI Interview 10348 3023
#> 40 DEMO_D WTINT2YR Full Sample 2 Year Interview Weight 10348 0
#> 41 DEMO_D WTMEC2YR Full Sample 2 Year MEC Exam Weight 10348 0
#> 42 DEMO_D SDMVPSU Masked Variance Pseudo-PSU 10348 0
#> 43 DEMO_D SDMVSTRA Masked Variance Pseudo-Stratum 10348 0
#> has_range nlevels skip
#> 1 NA NA NA
#> 2 FALSE 2 FALSE
#> 3 FALSE 3 FALSE
#> 4 FALSE 3 FALSE
#> 5 FALSE 3 FALSE
#> 6 TRUE 3 FALSE
#> 7 TRUE 2 FALSE
#> 8 TRUE 2 FALSE
#> 9 FALSE 6 FALSE
#> 10 FALSE 5 FALSE
#> 11 FALSE 5 FALSE
#> 12 FALSE 5 FALSE
#> 13 FALSE 12 FALSE
#> 14 FALSE 21 FALSE
#> 15 FALSE 8 FALSE
#> 16 FALSE 6 FALSE
#> 17 FALSE 9 FALSE
#> 18 TRUE 3 FALSE
#> 19 TRUE 3 FALSE
#> 20 FALSE 16 FALSE
#> 21 FALSE 16 FALSE
#> 22 TRUE 3 FALSE
#> 23 FALSE 4 FALSE
#> 24 FALSE 3 FALSE
#> 25 TRUE 3 FALSE
#> 26 FALSE 6 FALSE
#> 27 FALSE 8 FALSE
#> 28 FALSE 9 FALSE
#> 29 FALSE 8 FALSE
#> 30 FALSE 3 FALSE
#> 31 FALSE 3 FALSE
#> 32 FALSE 3 FALSE
#> 33 FALSE 3 FALSE
#> 34 FALSE 3 FALSE
#> 35 FALSE 3 FALSE
#> 36 FALSE 3 FALSE
#> 37 FALSE 3 FALSE
#> 38 FALSE 3 FALSE
#> 39 FALSE 3 FALSE
#> 40 TRUE 2 FALSE
#> 41 TRUE 2 FALSE
#> 42 TRUE 2 FALSE
#> 43 TRUE 2 FALSE