Skip to contents

Marks a battery of columns that ask the same question across looped items with identical response options (e.g. familiarity asked per brand). The columns share one alias; the per-column loop item is parsed from the label and stored in the loop metadata field. Response-level consistency across columns is validated.

Usage

step_set_loop_sr(
  x,
  .cols,
  alias = NULL,
  alias_name = NULL,
  description = NULL,
  template = "{question} | {loop}",
  snapshot_data = FALSE,
  status = TRUE
)

Arguments

x

A srv_tbl.

.cols

Tidy-select expression picking the looped columns.

alias

Alias (group key). Required — the looped columns share it.

alias_name

Human-friendly display name for the group.

description

Overrides the template-parsed question (group level).

template

Glue-style template. Default "{question} | {loop}".

snapshot_data

Logical. If TRUE, a snapshot with data is taken; if FALSE, without data; if NULL, no snapshot.

status

Logical. If TRUE, a status message is printed.

Examples

if (FALSE) { # \dontrun{
data("srv_example", package = "g6tr.survey")
x <- srv_example |> step_set_loop_sr(contains("m2_yes_no"), alias = "m2_yes_no")
} # }