library(datasets)
MySurvey <- multiwave(phases = 2, waves = c(1, 3))
set_mw(MySurvey, phase = 1, slot = "data") <-
dplyr::select(datasets::iris, -Sepal.Width)
# Get Design by applying optimum_allocation
MySurvey <- apply_multiwave(MySurvey,
phase = 2, wave = 1,
fun = "optimum_allocation", strata = "Species",
y = "Sepal.Length",
nsample = 15,
method = "WrightII"
)
# or, we can establish function args in the metadata
set_mw(MySurvey, phase = 2, slot = "metadata") <- list(
strata = "Species",
nsample = 15,
y = "Sepal.Length",
method = "WrightII"
)
# which allows the function to be run without specifying the args
MySurvey <- apply_multiwave(MySurvey,
phase = 2, wave = 1,
fun = "optimum_allocation"
)
Run the code above in your browser using DataLab