Learn R Programming

surveycore (version 0.8.3)

nhanes_2017: NHANES 2017-2018: Demographics and Blood Pressure

Description

A merged dataset from the National Health and Nutrition Examination Survey (NHANES) 2017-2018 cycle, combining demographic characteristics with blood pressure measurements. Covers all 9,254 sampled participants; blood pressure variables are NA for the 550 interview-only participants (ridstatr == 1).

Usage

nhanes_2017

Arguments

Format

A data frame with 9,254 rows and 14 variables:

seqn

Respondent sequence number (unique identifier, join key).

sdmvpsu

Masked variance pseudo-PSU. Use as the cluster ID for variance estimation. See Details.

sdmvstra

Masked variance pseudo-stratum. Use as the stratification variable for variance estimation. See Details.

wtmec2yr

Full-sample 2-year MEC examination weight. Use for any analysis involving examination measurements (e.g., blood pressure).

wtint2yr

Full-sample 2-year interview weight. Use for analyses based on interview data only.

ridstatr

Interview/examination status: 1 = interview only, 2 = both interview and MEC examination.

riagendr

Gender: 1 = male, 2 = female.

ridageyr

Age in years at screening, top-coded at 80.

ridreth3

Race/Hispanic origin (6 categories): 1 = Mexican American, 2 = Other Hispanic, 3 = Non-Hispanic White, 4 = Non-Hispanic Black, 6 = Non-Hispanic Asian, 7 = Other/Multiracial.

indfmpir

Ratio of family income to the federal poverty level (continuous, 0–5; values >5 are top-coded at 5).

dmdeduc2

Education level for adults 20+: 1 = Less than 9th grade, 2 = 9th–11th grade, 3 = High school graduate/GED, 4 = Some college/AA, 5 = College graduate or above.

bpxsy1

Systolic blood pressure, 1st reading (mm Hg). NA if not examined.

bpxdi1

Diastolic blood pressure, 1st reading (mm Hg). NA if not examined.

bpxpls

60-second pulse rate (beats per minute). NA if not examined.

Details

Survey design: Taylor series linearization. When creating a survey design object, use sdmvpsu as the cluster ID, sdmvstra as the stratum, and wtmec2yr as the weight for examination-based analyses:

svy <- as_survey(nhanes_2017,
  ids     = sdmvpsu,
  strata  = sdmvstra,
  weights = wtmec2yr
)

Use wtint2yr instead of wtmec2yr for interview-only variables (e.g., income, education).

Metadata: All columns carry variable labels and value labels as R attributes, automatically extracted into surveycore's metadata system when you call as_survey().

  • Variable labels ("label" attribute): A human-readable description of each column. Example: attr(nhanes_2017$riagendr, "label") returns "Gender".

  • Value labels ("labels" attribute): A named numeric vector mapping each code to its meaning. Example: attr(nhanes_2017$riagendr, "labels") returns c(Male = 1, Female = 2).

Source files: DEMO_J.xpt (demographics) merged with BPX_J.xpt (blood pressure) on seqn. Prepared by data-raw/download-nhanes.R.

Examples

Run this code
# All 9,254 participants (interview + exam)
head(nhanes_2017)

# Restrict to exam participants for blood pressure analysis
exam_only <- nhanes_2017[nhanes_2017$ridstatr == 2, ]

# Inspect variable label
attr(nhanes_2017$riagendr, "label")

# Inspect value labels
attr(nhanes_2017$riagendr, "labels")

# Inspect value labels for race/ethnicity
attr(nhanes_2017$ridreth3, "labels")

Run the code above in your browser using DataLab