I have what I thought was a basic task, but has proven otherwise. I have a series of surveys that I need to convert into frequency tables for each survey. For instance, Survey 1 consists of 6 questions in which participants had 5 response options. For each survey, I need to produce a table that has each question (in this example there are 6), along with the percentage of participants who responded with each response option per question.
I have been using prop.table but have only been able to do that for a single question at a time and I haven't figured out how to add a percentage sign, and I lose the question variable title in the row name.
Overall, I would like to print these tables right into a word document. That part I think I have figured out, but now I need to figure the tables out.
I welcome any suggestions. Thanks!
EDIT
Here is what I have so far using some sample Likert data:
q1<-c(2,2,3,3,3,4,4,4,5,5)
q2<-c(2,3,3,4,4,4,4,5,5,5)
q3<-c(2,2,2,3,4,4,4,5,5,5)
df<-data.frame(q1,q2,q3)
x<-prop.table(table(factor(df$q1,levels=1:5)))*100
y<-round(x,digits=1)`
That yields something similar to what I need. However, I would like "q1" to be in the resulting table as a row name, I would like the percentages to have a % sign, and I need a way to incorporate the two additional "q2" "q3" rows into that same table.
Hope that helps. Thank you.