flipArrays: Rearrange array subvariables into other configurations
Description
Sometimes it is useful to group subvariables across arrays in order to
compare them more easily. This function generates a set of derived views of
common subvariables across arrays. Because they are derived, they share data
with the underlying array variables, and they are thus automatically updated
when new data is appended.
Usage
flipArrays(variables, suffix = ", flipped")
Arguments
variables
List of variables, variable catalog, or dataset subset
containing the categorical array or multiple response variables you want to
rearrange.
suffix
character string to append to the new variable names. Make it
"" if you don't want it to append anything.
Value
A list of derived VariableDefinitions, one per unique subvariable
name across all variables. Each variable (in variables) that
contains this subvariable will appear
as a subvariable in these new derived array definitions. Use
addVariables to add these to your dataset.