1
我有一些數據,看起來像這樣:如何操縱彙總表結果
A B
6 Often Often
7 Always Always
8 Rarely Rarely
9 Sometimes Often
structure(list(A = structure(c(5L, 6L, 3L, 4L), .Label = c("",
"Almost Never", "Rarely", "Sometimes", "Often", "Always"), class = c("ordered",
"factor")), B = structure(c(5L, 6L, 3L, 5L), .Label = c("", "Almost Never",
"Rarely", "Sometimes", "Often", "Always"), class = c("ordered",
"factor"))), .Names = c("A", "B"), row.names = 6:9, class = "data.frame")
使用總結,我得到每種類型的反對可能的響應響應的,這正是我想要的東西的計數:
A B
:0 :0
Almost Never:0 Almost Never:0
Rarely :1 Rarely :1
Sometimes :1 Sometimes :0
Often :1 Often :2
Always :1 Always :1
現在我想操縱這些數字來獲得(經常+總是)/總迴應。總結輸出是字符輸出,雖然 - 我可以分割冒號,但必須有更好的方法。
如何計算給定上述數據集的每個問題的常數+總回答的百分比?