I have a dataframe with multiple choice questions, which have up to 25 different options. For each of these questions the options (from a SurveyMonkey download) get their own column - so there are as many columns as there are options and the string will appear in that column if the person has ticked that option.
Question: Select the three populations from this list that applies to you. The 20 options are: "We serve everyone", "Children", "Youth", "Older Adults", .....
My dataframe looks like this - The responses are organized under variable names Popn1 .... Popn20:
ID Popn1 Popn2 Popn3 ......... Popn20
A We serve everyone Children NA NA
B NA Children Youth "String"
C We serve everyone NA NA "String"
D NA Children Youth "String"
...
In SAS, I would turn these into binary variables (1/0, 1 if they selected the option, 0 if they did not). Each variable from Popn1 - Popn20 would be in the form of 1/0. I would then use a proc tabulate to get a sum (N) and mean (percent) and get one frequency table of these values.
In R, is there a way I can run a frequency table of all these variables, to get the count, as well as percent, by number of responses received for the question, without turning the columns into binary variables? All the options I've seen suggest to do this first, but I'm looking for an alternative solution if one exists, of somehow counting the number of instances of each string.
Preferred output:
Frequency counts for question: Select the 3 populations that apply to you.
n %
We serve everyone 6 10%
Children 10 16%
Youth 5 xx%
....
Label of Popn20 X xx%
Hope this is a bit clearer than my earlier post.