multiResponse function mimics the behavior of the table produced
by SPSS for multiple response questions.
multiResponse(data, items = NULL, regex = NULL, perlRegex = TRUE, endorsedOption = 1)
Dataframe containing the variables to display.
Whether to use the perl engine to match the regex.
Which value represents the endorsed option (note that producing this kind of table requires dichotomous items, where each variable is either endorsed or not endorsed, so this is also a way to treat other variables as dichotomour).
A dataframe with columns
Percentage of (X) cases, where X is the number
This function is based on the excellent and extensive Stack Exchange answer by Ananda Mahto at https://stackoverflow.com/questions/9265003/analysis-of-multiple-response.
multiResponse(mtcars, c('vs', 'am'));#> Option Frequency Percentage of responses Percentage of (32) cases #> 1 vs 14 51.85185 43.750 #> 2 am 13 48.14815 40.625 #> 3 Total 27 100.00000 84.375