Skip to contents

Creates 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_sample object produced by execute().

...

Additional arguments passed to as_svrepdesign().

Value

A replicate-weight tbl_svy object from the srvyr package.

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