if (requireNamespace("survey", quietly = TRUE)) {
sv <- survey::svydesign(
ids = ~sdmvpsu, weights = ~wtint2yr, strata = ~sdmvstra,
data = nhanes_2017, nest = TRUE
)
d <- from_svydesign(sv)
survey_data(d)
}
Run the code above in your browser using DataLab