
Extract the sampling frame from a bus-route creel design
Source:R/creel-design.R
get_sampling_frame.RdReturns the sampling frame data frame stored in a bus-route creel_design
object. The data frame contains the user's original columns plus a
precomputed .pi_i column (pi_i = p_site * p_period). Aborts with an
informative error for non-bus-route designs.
Value
A data frame: the sampling_frame as stored in the design, with
the addition of a .pi_i column and (if circuit was omitted) a
.circuit column.
See also
Other "Bus-Route Helpers":
get_enumeration_counts(),
get_inclusion_probs(),
get_site_contributions()
Examples
sf <- data.frame(
site = c("A", "B", "C"),
p_site = c(0.3, 0.4, 0.3),
p_period = 0.5
)
calendar <- data.frame(
date = as.Date("2024-06-01"),
day_type = "weekday"
)
design <- creel_design(calendar,
date = date,
strata = day_type,
survey_type = "bus_route",
sampling_frame = sf,
site = site,
p_site = p_site,
p_period = p_period
)
get_sampling_frame(design)
#> site p_site p_period .circuit .pi_i
#> 1 A 0.3 0.5 .default 0.15
#> 2 B 0.4 0.5 .default 0.20
#> 3 C 0.3 0.5 .default 0.15