nhanesTableVars: Displays a list of variables in the specified NHANES table.

View source: R/nhanes_tables.R

nhanesTableVarsR Documentation

Displays a list of variables in the specified NHANES table.

Description

Enables quick display of table variables and their definitions.

Usage

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).

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.

Value

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.

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)

nhanesA documentation built on July 4, 2024, 9:08 a.m.