createSubvarDeriv: Create subvariable derivation expressions

View source: R/make-array.R

createSubvarDerivR Documentation

Create subvariable derivation expressions

Description

This function creates a single subvariable definition based on a character string to search for and an originating variable. It uses regex to determine whether a string is present in a delimited list, then substitutes the user supplied values to indicate selection, non-selection, and missingness.

Usage

createSubvarDeriv(var, str, delim, selected, not_selected, unanswered)

Arguments

var

The variable containing the delimited responses

str

A string whose presence indicates a selection

delim

The delimiter separating the responses

selected

A character string used to indicate a selection, defaults to "selected"

not_selected

Character string identifying non-selection, defaults to "not_selected"

unanswered

Character string indicating non-response, defaults to NA.

Value

A VariableDefinition


crunch documentation built on Aug. 31, 2023, 1:07 a.m.