Skip to contents

Returns the sampling_design metadata attached to a tbl_sample. This is the original design object used to create the sample, including all stage specifications, labels, stratification, clustering, and draw settings.

Usage

get_design(x)

Arguments

x

A tbl_sample object.

Value

The sampling_design object stored in x.

Details

This is especially useful for:

  • inspecting the design after execution

  • programmatic workflows that need to branch on design metadata

  • continuation workflows, where later calls to execute() resume from a partially executed sample

Examples

design <- sampling_design(title = "Example") |>
  stratify_by(region) |>
  draw(n = 20)

sample <- execute(design, bfa_eas, seed = 1)

get_design(sample)
#> ── Sampling Design: Example ────────────────────────────────────────────────────
#> 
#> ℹ 1 stage
#> 
#> ── Stage 1 ─────────────────────────────────────────────────────────────────────
#> • Strata: region
#> • Draw: n = 20, method = srswor
#> 

# The returned object is the original sampling_design
is_sampling_design(get_design(sample))
#> [1] TRUE