View source: R/expand_choice.R
expand_choice | R Documentation |
Function to expand response to a more than one answer multiple choice question coded as a concatenated string
expand_choice(
df,
x,
values,
pattern = "",
prefix = x,
labels = values,
sep = "."
)
df |
A dataframe containing the vector data that requires expansion. |
x |
Name of variable in |
values |
Vector of string values used to create concatenated string response. |
pattern |
Pattern used to separate values in the concatenated string. Default is "" for concatenated strings with no separator. |
prefix |
Prefix to names of newly created variables. |
labels |
Vector of names to use for columns of resulting data.frame.
If not specified, columns are named using |
sep |
Charater to separate |
A data.frame with same rows as df
containing columns
corresponding to each newly created variable.
## Not run:
expandMultipleChoice(df = individual,
x = "mddw1",
values = as.character(0:18),
pattern = " ",
prefix = "mddw",
sep = "")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.