Skip to contents

Converts 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.

Usage

from_tbl_svy(x)

Arguments

x

A srvyr::tbl_svy object.

Value

A survey_taylor, survey_replicate, or survey_twophase object.

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)
}