nhanesTableVars function

Displays a list of variables in the specified NHANES table.

Displays a list of variables in the specified NHANES table.

Enables quick display of table variables and their definitions.

nhanesTableVars( data_group, nh_table, details = FALSE, nchar = 128, namesonly = FALSE )

Arguments

  • data_group: The type of survey (DEMOGRAPHICS, DIETARY, EXAMINATION, LABORATORY, QUESTIONNAIRE). Abbreviated terms may also be used: (DEMO, DIET, EXAM, LAB, Q).
  • nh_table: The name of the specific table to retrieve.
  • details: If TRUE then all columns in the variable description are returned (default=FALSE).
  • nchar: The number of characters in the Variable Description to print. Default length is 128, which is set to enhance readability cause variable descriptions can be very long.
  • namesonly: If TRUE then only the variable names are returned (default=FALSE).

Returns

Returns a data frame that describes variable attributes for the specified table. If namesonly=TRUE, then a character vector of the variable names is returned.

Details

NHANES tables may contain more than 100 variables. Function nhanesTableVars provides a concise display of variables for a specified table, which helps to ascertain quickly if the table is of interest. NULL is returned when an HTML read error is encountered.

Examples

lab_cbc = nhanesTableVars('LAB', 'CBC_E') dim(lab_cbc) exam_ohx = nhanesTableVars('EXAM', 'OHX_E', details=TRUE, nchar=50) dim(exam_ohx) demo = nhanesTableVars('DEMO', 'DEMO_F', namesonly = TRUE) length(demo)
  • Maintainer: Christopher Endres
  • License: GPL (>= 2)
  • Last published: 2025-01-10