powered by
Split multi-choice data into columns, each new column consists of booleans whether a choice is presented.
split_multichoice( df, quest_cols, split = "", remove_space = TRUE, link = "_", remove_cols = TRUE )
A data frame with additional columns.
A data frame.
A vector of column names that contain multi-choice data.
A string to split the data. Default is "".
""
If TRUE, remove space in the data.
TRUE
A string to link the column name and the option. Default is "_".
"_"
If TRUE, remove the original columns.
df <- data.frame(q1 = c("ab", "c da", "b a", NA), q2 = c("a b", "a c", "d", "ab")) split_multichoice(df, quest_cols = c("q1", "q2"))
Run the code above in your browser using DataLab