Convert a tbl_sample to a srvyr replicate-weight tbl_svy object
Source:R/survey.R
as_survey_rep.tbl_sample.RdCreates a srvyr::tbl_svy replicate design from a tbl_sample by first
converting to a svyrep.design object via as_svrepdesign(),
then wrapping with srvyr::as_survey_rep().
Usage
# S3 method for class 'tbl_sample'
as_survey_rep(.data, ...)Arguments
- .data
A
tbl_sampleobject produced byexecute().- ...
Additional arguments passed to
as_svrepdesign().
See also
as_svrepdesign() for survey replicate-weight export
Examples
library(srvyr)
sample <- sampling_design() |>
stratify_by(region, alloc = "proportional") |>
draw(n = 300) |>
execute(bfa_eas, seed = 42)
rep_tbl <- as_survey_rep(sample, type = "auto")
rep_tbl |>
summarise(mean_hh = survey_mean(households, vartype = "se"))
#> # A tibble: 1 × 2
#> mean_hh mean_hh_se
#> <dbl> <dbl>
#> 1 207. 4.69