Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

createSubvarDeriv

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.

missing

A logical vector indicating which variable entries are missing

Value

A VariableDefinition


crunch

Crunch.io Data Tools

v1.28.0
LGPL (>= 3)
Authors
Greg Freedman Ellis [aut, cre], Jonathan Keane [aut], Mike Malecki [aut], Neal Richardson [aut], Gordon Shotwell [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.