Skip to contents

A tidyselect helper that expands each survey type to every column carrying it — the type-oriented sibling of aliased(). Use it inside any tidyselect context (dplyr::select(), dplyr::across(), tidyr::pivot_longer(cols = )) and mix it freely with ordinary tidyselect:

select(srv, response_id, typed("sr"))       # every single-response column
select(srv, typed("mr", "loop_sr"))         # every grid / battery column

Recognised types are sr, mr, loop_sr, ft, fn, derived, weight, ignore, id, secondary_id, time and response_status. An unrecognised type errors with a suggestion; a recognised type that no column carries simply selects nothing.

Usage

typed(...)

Arguments

...

One or more type strings, e.g. typed("sr") or typed("mr", "fn").

Value

Integer column positions (consumed by tidyselect).

See also

aliased() to select by alias; get_variables() to list each column's type.

Examples

if (FALSE) { # \dontrun{
data("srv_example", package = "g6tr.survey")
x <- srv_example |> step_set_sr(s_gender)
dplyr::select(x, typed("sr"))
} # }