Convert an srvyr tbl_svy to a surveycore Design Object
Source:R/methods-conversion.R
from_tbl_svy.RdConverts an srvyr tbl_svy to a surveycore design object by delegating
to from_svydesign(). A tbl_svy IS a survey.design, so the conversion
is structurally identical. Requires both survey and srvyr.
Arguments
- x
A
srvyr::tbl_svyobject.
See also
as_tbl_svy() to convert in the other direction
Other conversion:
as_svydesign(),
as_tbl_svy(),
from_svydesign()
Examples
if (requireNamespace("survey", quietly = TRUE) &&
requireNamespace("srvyr", quietly = TRUE)) {
ts <- srvyr::as_survey(
survey::svydesign(ids = ~sdmvpsu, weights = ~wtint2yr,
strata = ~sdmvstra, data = nhanes_2017, nest = TRUE)
)
d <- from_tbl_svy(ts)
}