nhanes_design: Generate NHANES design object

Description Usage Arguments Value Examples

View source: R/survey_functions.R

Description

Takes a data.frame with NHANES data and at least one weight variable, and creates the proper design object for it. It simply puts the proper PSU strata, nest, and user-supplied weight into the svydesign function. Note this does NOT set options(survey.lonely.psu = "adjust").

Usage

1
nhanes_design(df, wt = "WTINT2YR")

Arguments

df

a data.frame or data.table created from NHANES data

wt

The weight variable in the data as a character vector. Common options include WTINT2YR, WTMEC2YR, and WTSA2YR. See NHANES documentation for assigning weights across multiple years, and for choosing weights when there is more than 1 sampling frame (e.g., interview, mobile exam, fasting laboratory values, and other data subsets)

Value

Returns a survey design object (which contains all of the data) for use in analyses

Examples

1
2
3
4
## Not run: 
nhanes_design(df = df, wt = "WTINT2YR")

## End(Not run)

outcomesinsights/nhanes.tools documentation built on May 24, 2019, 5:54 p.m.