d <- as_survey(nhanes_2017, ids = sdmvpsu, weights = wtint2yr,
strata = sdmvstra, nest = TRUE)
if (requireNamespace("survey", quietly = TRUE)) {
sv <- as_svydesign(d)
survey::svymean(~ridageyr, sv, na.rm = TRUE)
}
Run the code above in your browser using DataLab