Skip to contents

Converts a surveycore design object to an srvyr tbl_svy by first converting to a survey design via as_svydesign() and then wrapping with srvyr::as_survey(). Requires both survey and srvyr.

Usage

as_tbl_svy(x)

Arguments

x

A survey_taylor, survey_replicate, or survey_twophase object.

Value

A srvyr::tbl_svy object.

Details

Metadata (variable labels, value labels) is NOT carried over.

See also

from_tbl_svy() to convert back from a tbl_svy object

Other conversion: as_svydesign(), from_svydesign(), from_tbl_svy()

Examples

d <- as_survey(nhanes_2017, ids = sdmvpsu, weights = wtint2yr,
               strata = sdmvstra, nest = TRUE)
if (requireNamespace("survey", quietly = TRUE) &&
    requireNamespace("srvyr",  quietly = TRUE)) {
  ts <- as_tbl_svy(d)
}