| multi_freq {surveyexplorer} | R Documentation | 
Generate an UpSet plot for multiple-choice questions
Description
Visualize multiple-choice question responses with an upset plot, a visual
tool for exploring the overlap and distribution of multiple-choice question
responses. The function supports optional subgrouping of data using the
group_by variable, exclusion of specific subgroups with
'subgroups_to_exclude,' and data weighting with the 'weights' parameter.
Users can also choose to exclude NA values from the questions prior to
analysis using the 'na.rm' parameter.
Usage
multi_freq(
  dataset,
  question,
  group_by = NULL,
  subgroups_to_exclude = NULL,
  weights = NULL,
  na.rm = FALSE
)
Arguments
| dataset | The input dataframe (or tibble) of survey questions | 
| question | The columns that contain each of the response options for a question, can be selected by using tidyselect semanatics or providing a vector of column names or numbers | 
| group_by | Optional variable to group the analysis. If provided, the frequencies and counts will be calculated within each subgroup. | 
| subgroups_to_exclude | Optional vector specifying subgroups to exclude from the analysis. | 
| weights | Optional variable containing survey weights. If provided, frequencies and counts will be weighted accordingly. | 
| na.rm | Logical indicating whether to remove NA values from  | 
Value
An upset plot visualizing the distribution of responses to the multiple-choice question.
See Also
Other multiple-choice questions: 
multi_summary(),
multi_table()
Examples
#Use dplyr to select questions
library(dplyr)
#Basic Upset plot
#Use `group_by` to partition the question into several groups
 multi_freq(berlinbears, question = dplyr::starts_with('will_eat'), group_by
 = gender)
#to ignore a subgroup, use `subgroups_to_exclude`
multi_freq(berlinbears, question = dplyr::starts_with('will_eat'), group_by =
gender, subgroups_to_exclude = NA)
#Specifiy survey weights with `weights`
 multi_freq(berlinbears, question = dplyr::starts_with('will_eat'), group_by
 = gender, weights = weights)