Downloads and parses NHANES manifests for data tables and variables, and returns them as data frames.

nhanesManifest(
  which = c("public", "limitedaccess", "variables"),
  sizes = FALSE,
  dxa = FALSE,
  component = NULL,
  verbose = getOption("verbose"),
  use_cache = TRUE,
  max_age = 24 * 60 * 60
)

Arguments

which

Either "public" or "limitedaccess" to get a manifest of available tables, or "variables" to get a manifest of available variables.

sizes

Logical, whether to compute data file sizes (as reported by the server) and include them in the result.

dxa

Logical, whether to include information on DXA tables. These tables contain imputed imputed Dual Energy X-ray Absorptiometry measurements, and are listed separately, not in the main listing.

component

An optional character string specifying the component for which the public data manifest is to be downloaded. Valid values are "demographics", "dietary", "examination", "laboratory", and "questionnaire". Partial matching is allowed, and case is ignored. Specifying a component for the public manifest will return a subset of the tables, but has the advantage that the result will include a description of each table.

verbose

Logical flag indicating whether information on progress should be reported.

use_cache

Logical flag indicating whether a cached version (from a previous download in the same session) should be used.

max_age

Maximum allowed age of the cache in seconds (defaults to 24 hours). Cached versions that are older are ignored, even if available.

Value

A data frame, with columns that depend on which.

For a manifest of tables, columns are "Table", "DocURL", "DataURL", "Years", "Date.Published". If component is specified, an additional column "Description" giving a description of the table will be included. If sizes = TRUE, an additional column "DataSize" giving the data file sizes in bytes (as reported by the server) is included.

For limited access tables, the "DataURL" and "DataSize" columns are omitted.

For a manifest of variables, columns are "VarName", "VarDesc", "Table", "TableDesc", "BeginYear", "EndYear", "Component", and "UseConstraints".

Details

The NHANES website maintains several listings (manifests) of tables and associated variables, which can be downloaded using these functions.

The list of tables for which data is available publicly can be found at https://wwwn.cdc.gov/Nchs/Nhanes/search/DataPage.aspx, with further restriction to specific components possible by specifying an additional query parameter as below. This is the public manifest.

Limited access tables (also referred to as RDC only tables) are listed at https://wwwn.cdc.gov/Nchs/Nhanes/search/DataPage.aspx?Component=LimitedAccess. This is the limited access manifest.

Available variables are listed according to component at https://wwwn.cdc.gov/nchs/nhanes/search/variablelist.aspx?Component=Demographics, etc. These are the variable manifests.

Note

Duplicate rows are removed from the result. Most of these duplicates arise from duplications in the source tables for multi-cycle tables (which are repeated once for each cycle). One special case is the WHQ table which has two variables, WHD120 and WHQ030, duplicated with differing variable descriptions. These are removed explicitly, keeping only the first occurrence.

Examples

manifest <- nhanesManifest(sizes = FALSE)
dim(manifest)
#> [1] 1579    5
varmf <- nhanesManifest("variables", component = "lab")
head(varmf)
#>    VarName
#> 1  AIALANG
#> 2  DMDBORN
#> 3 DMDCITZN
#> 4 DMDEDUC2
#> 5 DMDEDUC3
#> 6 DMDFMSIZ
#>                                                                                                                                                                                                                                                                                                                                                            VarDesc
#> 1                                                                                                                                                                                                                                                                                                                   Language of the MEC ACASI Interview Instrument
#> 2                                                                                                                                                                                                                                                                                                                          In what country {were you/was SP} born?
#> 3 {Are you/Is SP} a citizen of the United States? [Information about citizenship is being collected by the U.S. Public Health Service to perform health related research. Providing this information is voluntary and is collected under the authority of the Public Health Service Act. There will be no effect on pending immigration or citizenship petitions.]
#> 4                                                                                                                                                                                                              (SP Interview Version) What is the highest grade or level of school {you have/SP has} completed or the highest degree {you have/s/he has} received?
#> 5                                                                                                                                                                                                              (SP Interview Version) What is the highest grade or level of school {you have/SP has} completed or the highest degree {you have/s/he has} received?
#> 6                                                                                                                                                                                                                                                                                                                             Total number of people in the Family
#>    Table                              TableDesc BeginYear EndYear    Component
#> 1 DEMO_D Demographic Variables & Sample Weights      2005    2006 Demographics
#> 2 DEMO_D Demographic Variables & Sample Weights      2005    2006 Demographics
#> 3 DEMO_D Demographic Variables & Sample Weights      2005    2006 Demographics
#> 4 DEMO_D Demographic Variables & Sample Weights      2005    2006 Demographics
#> 5 DEMO_D Demographic Variables & Sample Weights      2005    2006 Demographics
#> 6 DEMO_D Demographic Variables & Sample Weights      2005    2006 Demographics
#>   UseConstraints
#> 1           None
#> 2           None
#> 3           None
#> 4           None
#> 5           None
#> 6           None