Decode Multi-Select Variables
decode_multi_select.RdDecodes multi-select coded variables by mapping coded values to their corresponding meanings within bracketed strings.
Value
Character vector with decoded values. Multi-select values maintain bracketed format with decoded meanings separated by pipes.
Details
This function processes multi-select data where each observation may contain multiple coded values separated by commas or pipes within brackets. It replaces coded values with their decoded meanings while preserving the multi-select structure. All separators are normalized to pipes for downstream uniformity.
See also
decode_single_select for single-select decoding
decode_ofh_variable for the generic decoder
Examples
if (FALSE) { # \dontrun{
# Create mapping
codes <- c("A1", "B2", "C3")
meanings <- c("Option A", "Option B", "Option C")
# Decode multi-select variables
# decoded <- decode_multi_select(
# x = c("[A1,B2]", "[C3]", "[A1|B2|C3]"),
# code = codes,
# meaning = meanings
# )
# Result: c("[Option A|Option B]", "[Option C]", "[Option A|Option B|Option C]")
} # }