Skip to contents

This function processes checkbox matrix variables in a dataset, transforming their representations into one of the specified formats.

Usage

ns_alter_checkbox(data, to = c("character", "list"), sep = ",", cb = NULL)

Arguments

data

A `data.frame` containing the dataset to modify.

to

A character string specifying the output format for checkbox matrix variables. Must be one of "character" or "list".

sep

A character string used as a separator when `to = "character"`. Defaults to `","`.

cb

An optional codebook (`data.frame`) to identify checkbox matrix variables. If `NULL`, the codebook is generated using `ns_get_codebook()`.

Value

A modified `data.frame` with processed checkbox matrix variables.

Examples

if (FALSE) { # \dontrun{
dt <- ns_get_data(11000)
ns_alter_checkbox(data = dt, to = "list")
ns_alter_checkbox(data = dt, to = "character", sep = ";")
} # }