Returns the stage indices that have been executed for a tbl_sample.
For a fully executed single-stage design, this is typically 1L. For
partial execution or continuation workflows, this indicates how far the
design has progressed.
Details
This is mainly useful for:
checking whether a multi-stage design was executed completely
writing continuation workflows that resume from the next stage
inspecting samples created with
stages =inexecute()
See also
Other helpers:
as_tbl_sample(),
bound(),
get_design(),
is_sampling_design(),
is_tbl_sample(),
print.samplyr,
serp()
Examples
design <- sampling_design() |>
add_stage("EAs") |>
cluster_by(ea_id) |>
draw(n = 10) |>
add_stage("Households") |>
draw(n = 5)
stage1 <- execute(design, bfa_eas, stages = 1, seed = 1)
get_stages_executed(stage1)
#> [1] 1
full_sample <- execute(stage1, bfa_eas, seed = 2)
#> Warning: Stage 2: selected every unit available in the pools it executed.
#> ✖ Requested 50 units, selected all 10 available.
#> ℹ Exhausted pools: "11611", "15528", "45236", "21818", "43475", and 5 more.
#> ℹ This stage contributes no sampling variance. Earlier stages are unaffected:
#> the design as a whole is a census only if every stage is.
get_stages_executed(full_sample)
#> [1] 1 2