Skip to contents

Marks one or more columns as single-response (SR) variables: coerces each to a factor and attaches the flat metadata schema. Each selected column is its own group (its own alias), so alias, alias_name, description and label apply only when a single column is selected.

Usage

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

Arguments

x

A srv_tbl.

.cols

Tidy-select expression picking the SR columns.

alias

Alias (group key). Defaults to the column name. Single column only.

alias_name

Human-friendly display name. Single column only.

description

Overrides the template-parsed description. Single column only.

label

Sets attr(col, "label") directly. Single column only.

template

Glue-style template parsed from the label. Default "{question}".

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_sr(c(s_age_group, s_generation, s_gender))
x$s_gender
} # }