buffered_random_sampling: Buffered Random Sampling

View source: R/buffered_random_sampling.R

buffered_random_samplingR Documentation

Buffered Random Sampling

Description

Run the buffered random sampling algorithm.

Usage

buffered_random_sampling(
  element,
  stratum,
  preselect_element = NULL,
  visualise = FALSE,
  verbose = FALSE,
  pause = FALSE,
  detail = 2,
  tau = 0.5
)

Arguments

element

data.frame See element.

stratum

date.frame See stratum.

preselect_element

data.frame same format as element, but only requires the columns elementId and stratum. All elements in this data set are selected before the algorithm starts running.

visualise

logical If TRUE a plot of the current stage of the algorithm is shown.

verbose

logical Print status while the algorithm is running.

pause

logical Stop the algorithm to inspect progress. Makes most sense when used together with visualise or verbose.

detail

numeric. Control how often visualise, verbose, and pause are shown, printed, or executed. Possible values 1, 2, 3, and 4, corresponding to finish, after each stratum, each time the algorithm is reset, or after every element.

tau

numeric. Sets the initial "packing intensity". Default is 0.5. See the paper for more detail.

Details

The function requires two data sets and returns a data frame with the result of the buffered random sampling.

Value

Data frame listing which stratum each element is associated with.

Examples

# See vignette("buffersam") for more examples.
allocation <- buffered_random_sampling(element, stratum)


johan-ejstrud/buffersam documentation built on July 31, 2024, 7:40 p.m.