View source: R/multipleChoiceExpand.R
expandMultChoice | R Documentation |
ab ac ad ef eg eh 1 1 1 0 0 0 0 0 0 1 1 1
expandMultChoice(answers, choices = NULL, naCode = NULL, naQuestion = NULL)
answers |
Character vector with given answers (strings containing the choices) |
choices |
(optional) Character vector with choices to be used (each will
become a column). If not supplied, choices will be determined from the
|
naCode |
(optional) Single element specifying what character code
equates to |
naQuestion |
(optional) TRUE/FALSE vector of the same length as answers;
in rows where this is false, all columns will be coded as |
a data frame with multiple separate 0/1 columns
naCode
must exist as the only answer in a column (an
answer that contains both a valid answer and the NA
code will not be
recognized as NA
- instead, the NA
code will be output as an
extra answer column (if choices
parameter is not given))
# Expand responses in variable w7 of sampleData2
sampleData2 <- renameODK(sampleData2)
temp <- expandMultChoice(sampleData2$ws7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.