Skip to contents

A frame is a data frame or a non-empty ordered list of data frames. A data frame and a one-element list containing it have the same meaning. execute() also accepts separate data-frame arguments after frame.

Details

One hierarchy or separate registers

A single hierarchy contains the rows needed for the requested stages, including parent identifiers. Variables describing a selected cluster, such as its MOS and stratum, must be constant within that cluster. Separate registers describe one sampling level each and map positionally to the requested stages. List names label registers in messages. They do not reorder stages or define joins. Child registers carry the parent keys needed to identify eligible descendants.

Continuing fieldwork

Use execute(partial_sample, next_register) to resume the same design after listing. The earlier selection and weights are retained, and omitting stages executes every remaining stage. If one supplied frame could cover either the next stage or several remaining stages, the two draw different samples, so execute() refuses to guess and asks for stages (samplyr_error_ambiguous_continuation). validate_frame() applies the same rule.

A listing derived from the partial sample, for example with dplyr::reframe() or tidyr::uncount(), may carry its generated columns (.weight, .fpc_1, ...). A continuation strips them before sampling. Passing the original design as .data instead starts a new execution at stage 1 and treats a tbl_sample frame as a previous phase. When that frame is a strict partial result of the same design, execute() warns but proceeds, since a new phase is a valid operation. A plain listing that still carries sampling attributes or generated columns is refused as the frame of a fresh design execution. To use such rows as an unrelated frame, remove both.

Use execute(new_design, previous_sample) to select a new phase from an earlier sample. This records an additional probability-sampling operation. It is distinct from continuing the unfinished stages of a design.

Frame checks apply before selection: column names must be unambiguous, design variables must be present, and keys and cluster-level variables must satisfy the design's identity rules. A frame fingerprint in a saved design records the supplied data. It does not certify executability.

Other data frame classes

A frame of a class that extends data.frame, other than a tibble, is read by its columns. Every column is kept with its own class, and the frame class's own methods (for example a subsetting rule that always keeps a column) are not used, so the sample is the one the same columns in a plain data frame give. The sample is a tibble whatever the frame's class.

The grouping of a grouped or rowwise frame is ignored, and the result is not grouped. Grouping does not stratify a design: strata are declared with stratify_by(). The first time this happens in a session a message says so.