<- nhanes('DEMO_J') # Both males and females 0 YEARS - 150 YEARS
demo <- demo[c("SEQN", # Respondent sequence number
demo1 "RIDAGEYR", # Age in years at screening
"RIAGENDR", # gender
"DMDEDUC2", # Education level - Adults 20+
"RIDRETH1", # race/ethnicity
"DMDMARTL", # marital status
"INDHHIN2", # Annual household income
"DMDBORN4", # where born
"RIDEXPRG", # Pregnancy status at exam (released for 20-44 yrs)
"SDDSRVYR", # survey cycle
"WTINT2YR", # Full sample 2 year weights
"WTMEC2YR", # Full sample 2 year MEC exam weight
"SDMVPSU", # Masked variance pseudo-PSU
"SDMVSTRA")]# Masked variance pseudo-stratum
<- names(demo1)
demo_vars <- nhanesTranslate('DEMO_J', demo_vars, data = demo1)
demo2 #> No translation table is available for SEQN
#> Translated columns: RIAGENDR DMDEDUC2 RIDRETH1 DMDMARTL INDHHIN2 DMDBORN4 RIDEXPRG
saveRDS(demo2, file = "data/components/demo17.RData")
22 Download cycle 10
Downloading NHANES 2017-18 cycle components
22.1 Download and Subsetting to retain only the useful variables
22.1.1 Demographic
Demographic Variables and Sample Weights (DEMO_H): The 2-year sample weights (WTINT2YR, WTMEC2YR) should be used. 15 masked variance strata and 30 masked primary sampling units (PSUs) are included in the demographics file. Each stratum has 2 PSUs.
22.1.2 BMI
Body Measures (BMX_H): The NHANES examination sample weights should be used to analyze the body measurement data. However, if the data is joined with data from the MEC, the MEC sample weights should be used.
<- nhanes('BMX_J')
bmx <- bmx[c("SEQN", # Respondent sequence number
bmx1 "BMXBMI")] # Body Mass Index (kg/m**2): 2 YEARS - 150 YEARS
<- names(bmx1)
bmx_vars <- nhanesTranslate('BMX_J', bmx_vars, data = bmx1)
bmx2 #> No translation table is available for SEQN
#> Warning in nhanesTranslate("BMX_J", bmx_vars, data = bmx1): No columns were
#> translated
saveRDS(bmx2, file = "data/components/bmx17.RData")
22.1.3 Diabetes
Diabetes (DIQ_H): diabetes questionnaire data must be conducted using the appropriate survey design variables, sample weights, and the basic demographic variables. Interview weights should only be used if questionnaire data are analyzed by themselves. However, if the data is joined with data from the MEC, the MEC sample weights should be used.
<- nhanes('DIQ_J')
diq <- diq[c("SEQN", # Respondent sequence number
diq1 "DIQ010", # Doctor told you have diabetes
"DIQ050", # Taking insulin now
"DIQ070", # Take diabetic pills to lower blood sugar
"DIQ175A")] # Family history
<- names(diq1)
diq_vars <- nhanesTranslate('DIQ_J', diq_vars, data = diq1)
diq2 #> No translation table is available for SEQN
#> Translated columns: DIQ010 DIQ050 DIQ070 DIQ175A
saveRDS(diq2, file = "data/components/diq17.RData")
22.1.4 Smoking
Smoking - Cigarette Use (SMQ_H): Interview weights should only be used if questionnaire data are analyzed by themselves. However, if the data is joined with data from the MEC, the MEC sample weights should be used.
<- nhanes('SMQ_J')
smq <- smq[c("SEQN", # Respondent sequence number
smq1 "SMQ020", # Smoked at least 100 cigarettes in life
"SMQ040")] # Do you now smoke cigarettes?: 18 YEARS - 150 YEARS
<- names(smq1)
smq_vars <- nhanesTranslate('SMQ_J', smq_vars, data = smq1)
smq2 #> No translation table is available for SEQN
#> Translated columns: SMQ020 SMQ040
saveRDS(smq2, file = "data/components/smq17.RData")
22.1.5 Diet
Diet Behavior & Nutrition (DBQ_H): interview sample weights may be used in their analysis. However, if the data is joined with data from the MEC, the MEC sample weights should be used.
<- nhanes('DBQ_J')
dbq <- dbq[c("SEQN", # Respondent sequence number
dbq1 "DBQ700")] # How healthy is the diet: 16 YEARS - 150 YEARS
<- names(dbq1)
dbq_vars <- nhanesTranslate('DBQ_J', dbq_vars, data = dbq1)
dbq2 #> No translation table is available for SEQN
#> Translated columns: DBQ700
saveRDS(dbq2, file = "data/components/dbq17.RData")
22.1.6 Physical activity
Physical Activity (PAQ_H): the interview sample weights should be used in their analysis. However, if the data is joined with data from the MEC, the MEC sample weights should be used.
<- nhanes('PAQ_J')
paq <- paq[c("SEQN", # Respondent sequence number
paq1 "PAQ605")] # Vigorous work activity: 18 YEARS150 YEARS
<- names(paq1)
paq_vars <- nhanesTranslate('PAQ_J', paq_vars, data = paq1)
paq2 #> No translation table is available for SEQN
#> Translated columns: PAQ605
saveRDS(paq2, file = "data/components/paq17.RData")
22.1.7 Access to healthcare
Hospital Utilization & Access to Care (HUQ_H): Although these data were collected as part of the household questionnaire, if they are merged with the MEC exam data, exam sample weights should be used for the analyses.
<- nhanes('HUQ_J')
huq <- huq[c("SEQN", # Respondent sequence number
huq1 "HUQ030")] # Routine place to go for healthcare
<- names(huq1)
huq_vars <- nhanesTranslate('HUQ_J', huq_vars, data = huq1)
huq2 #> No translation table is available for SEQN
#> Translated columns: HUQ030
saveRDS(huq2, file = "data/components/huq17.RData")
22.1.8 Blood pressure
Blood Pressure (BPX_H): Exam sample weights should be used for analyses.
- Systolic blood pressure and maximum inflation level cannot be greater than 300 mmHg;
- Systolic and diastolic blood pressure measurements and the maximum inflation level can be even numbers only;
- Systolic blood pressure must be greater than diastolic blood pressure;
- If there is no systolic blood pressure, there can be no diastolic blood pressure. (There can be a systolic measurement without a diastolic measurement.); and
- Diastolic blood pressure can be zero.
<- nhanes('BPX_J')
bpx <- bpx[c("SEQN", # Respondent sequence number
bpx1 "BPXSY1", # Systolic Blood pres (1st rdg) mmHg: 8 - 150 YEARS
"BPXSY2", # Systolic: Blood pres (2nd rdg) mm Hg
"BPXSY3", # Systolic: Blood pres (3rd rdg) mm Hg
"BPXSY4", # Systolic: Blood pres (4th rdg) mm Hg
"BPXDI1", # Diastolic Blood pres (1st rdg) mmHg: 8 - 150 YEARS
"BPXDI2", # Diastolic: Blood pres (2nd rdg) mm Hg
"BPXDI3", # Diastolic: Blood pres (3rd rdg) mm Hg
"BPXDI4")] # Diastolic: Blood pres (4th rdg) mm Hg
<- names(bpx1)
bpx_vars <- nhanesTranslate('BPX_J', bpx_vars, data = bpx1)
bpx2 #> No translation table is available for SEQN
#> Warning in nhanesTranslate("BPX_J", bpx_vars, data = bpx1): No columns were
#> translated
saveRDS(bpx2, file = "data/components/bpx17.RData")
Blood Pressure & Cholesterol (BPQ_H): Although these data were collected as part of the household questionnaire, if they are merged with the MEC exam data, exam sample weights should be used for the analyses.
<- nhanes('BPQ_J')
bpq <- bpq[c("SEQN", # Respondent sequence number
bpq1 "BPQ080")] # high cholesterol
<- names(bpq1)
bpq_vars <- nhanesTranslate('BPQ_J', bpq_vars, data = bpq1)
bpq2 #> No translation table is available for SEQN
#> Translated columns: BPQ080
saveRDS(bpq2, file = "data/components/bpq17.RData")
22.1.9 Sleep
<- nhanes('SLQ_J')
slq <- slq[c("SEQN", # Respondent sequence number
slq1 "SLD012")] # Sleep hours - weekdays or workdays
<- names(slq1)
slq_vars <- nhanesTranslate('SLQ_J', slq_vars, data = slq1)
slq2 #> No translation table is available for SEQN
#> Warning in nhanesTranslate("SLQ_J", slq_vars, data = slq1): No columns were
#> translated
saveRDS(slq2, file = "data/components/slq17.RData")
22.1.10 Laboratory data
Standard Biochemistry Profile (BIOPRO_H): Exam sample weights should be used for analyses.
# Standard Biochemistry Profile
<- nhanes('BIOPRO_J') # 12 YEARS - 150 YEARS
biopro <- biopro[c("SEQN", # Respondent sequence number
biopro1 #"LBXSTR", # Triglycerides, refrigerated (mg/dL)
"LBXSUA", # Uric acid (mg/dL)
"LBXSTP", # Total protein (g/dL)
"LBXSTB", # Total bilirubin (mg/dL)
"LBXSPH", # Phosphorus (mg/dL)
"LBXSNASI", # Sodium (mmol/L)
"LBXSKSI", # Potassium (mmol/L)
"LBXSGB", # Globulin (g/dL)
"LBXSCA")] # Total Calcium (mg/dL)
<- names(biopro1)
biopro_vars <- nhanesTranslate('BIOPRO_J', biopro_vars, data = biopro1)
biopro2 #> No translation table is available for SEQN
#> Warning in nhanesTranslate("BIOPRO_J", biopro_vars, data = biopro1): No columns
#> were translated
saveRDS(biopro2, file = "data/components/biopro17.RData")
22.1.11 ICD-10-CM codes
Prescription Medications (RXQ_RX_H): The Prescription Medications subsection provides personal interview data on use of prescription medications during a one-month period prior to the participant’s interview date. During the household SP interview, survey participants are asked if they have taken medications in the past 30 days for which they needed a prescription. Those who answer “yes” are asked to show the interviewer the medication containers of all the products used.
<- nhanes('RXQ_RX_J')
rxq <- rxq[c("SEQN", # Respondent sequence number
rxq10 "RXDRSC1")] # ICD-10-CM code 1
<- names(rxq10)
rxq11 <- nhanesTranslate('RXQ_RX_J', rxq11, data = rxq10)
rxq12 #> No translation table is available for SEQN
#> Translated columns: RXDRSC1
<- rxq[c("SEQN", # Respondent sequence number
rxq20 "RXDRSC2")] # ICD-10-CM code 2
<- names(rxq20)
rxq21 <- nhanesTranslate('RXQ_RX_J', rxq21, data = rxq20)
rxq22 #> No translation table is available for SEQN
#> Translated columns: RXDRSC2
<- rxq[c("SEQN", # Respondent sequence number
rxq30 "RXDRSC3")] # ICD-10-CM code 3
<- names(rxq30)
rxq31 <- nhanesTranslate('RXQ_RX_J', rxq31, data = rxq30)
rxq32 #> No translation table is available for SEQN
#> Translated columns: RXDRSC3
saveRDS(rxq12, file = "data/components/rxq1217.RData")
saveRDS(rxq22, file = "data/components/rxq2217.RData")
saveRDS(rxq32, file = "data/components/rxq3217.RData")
22.2 Merging all the datasets - except for ICD-10 codes
<- join_all(list(demo2, bmx2, diq2, smq2, dbq2, paq2,
dat
huq2, bpx2, bpq2, slq2, biopro2),by = "SEQN", type='full')
<- dat nhanes17
22.2.1 Save dataset for later use
dim(nhanes17)
#> [1] 9254 42
save(nhanes17, rxq12, rxq22, rxq32, file = "data/analytic17.RData")