2017-01-16 34 views
0

我試圖讓分組選項正常工作。 當我選擇分組時,我收到錯誤的數據。這裏是我的代碼R正確使用分組Likert

> likert(GroupCD[16]) 
    Item Strongly Disagree Disagree Neutral Agree Strongly Agree 
1 Q16     0  0 10.71429 46.42857  42.85714 
> likert(GroupCD[16],grouping = GroupCD$Group) 
    Group Item Strongly Disagree Disagree Neutral Agree Strongly Agree 
1  C Q16   6.666667 33.33333 60.00000  0    0 
2  D Q16   15.384615 61.53846 23.07692  0    0 

由於可以看到當由組分隔的值是錯誤的,或許(可能)我使用這個錯誤。

下面是組列

> print(GroupCD$Group) 
[1] "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" 

有什麼建議?

編輯:這裏是GroupCD [16]

"Q16" 
    "1" "Strongly Agree" 
    "2" "Strongly Agree" 
    "3" "Strongly Agree" 
    "4" "Strongly Agree" 
    "5" "Agree" 
    "6" "Agree" 
    "7" "Strongly Agree" 
    "8" "Strongly Agree" 
    "9" "Agree" 
    "10" "Strongly Agree" 
    "11" "Strongly Agree" 
    "12" "Neutral" 
    "13" "Strongly Agree" 
    "14" "Agree" 
    "15" "Agree" 
    "16" "Neutral" 
    "17" "Strongly Agree" 
    "18" "Strongly Agree" 
    "19" "Agree" 
    "20" "Agree" 
    "21" "Agree" 
    "22" "Agree" 
    "23" "Agree" 
    "24" "Strongly Agree" 
    "25" "Agree" 
    "26" "Neutral" 
    "27" "Agree" 
    "28" "Agree" 
+0

'GroupCD [16]'中的數據樣本將有助於瞭解你的情況發生了什麼。 –

+0

我的壞= /我剛剛編輯 –

+0

我無法重現您的結果。 檢查'Q16'和'group'類,如果它們屬於「ordered」類,請嘗試將它們更改爲「factor」(無順序),然​​後再次嘗試'likert'。 –

回答

0

因此,我可以關閉此: 顯然它與在R工作區/會話垃圾的問題(??)。一旦我開始了一個新的一切,一切正常