Skip to contents

Marks columns we created ourselves rather than fielded questions — recodes, collapsed variables, penalty / cleaning scores (ps_* / cs_*). Unlike the question types it performs no class coercion: it only attaches the flat metadata schema. Each column is its own group, so alias, alias_name, description and label apply only when a single column is selected.

Usage

step_set_derived(
  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 derived 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 |> 
  mutate(ps_rusher = 0) |> 
  step_set_derived("ps_rusher")
} # }