View source: R/generate_topline_multiselect.R
generate_topline_multiselect | R Documentation |
This function generates a single topline for cases where there is no parent response column in the
multiselect question. These cases are organized such that each column in df
represents a single choice
in a multiselect question. Alternatively, there may be cases where df
is structured such that the
first column represents a parent of the multiselect question in addition to the choices
or children columns that represent the multiselect choices. In such cases, two toplines will
be generated— one for the parent response and another for the choices columns. Users may control the output
with the parent
argument. Note that, for multiselect questions that involve a parent response column,
it is assumed that such a column is the first column of the argument df
. Therefore, some pre-processing may be
needed to ensure that this requirement is met.
generate_topline_multiselect(df, weight, caption, parent = FALSE)
df |
A data frame or data.table or tibble. |
weight |
A single string of the weighting variable. |
caption |
A length one character vector used as the caption for the topline. |
parent |
A boolean indicating whether |
A list object containing a either one or two objects of class flextable
.
apply_topline_multiselect()
for vectorized topline generation for multiple selection questions.
# Generate a topline (multiselect) df %>% generate_topline_multiselect( df = ., "weight", "caption", FALSE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.