【发布时间】:2017-10-09 12:19:48
【问题描述】:
我正在尝试使用 RStdudio v1.0.153 生成带有李克特规模数据的 R 图。我收到以下错误:
Error in likert(think) :
All items (columns) must have the same number of levels
我的数据链接在:https://docs.google.com/spreadsheets/d/1TYUr-_oX9eADZ6it1w_4CQJ_wITP6xISaJJHTad3JbA/edit?usp=sharing
下面是我使用的R代码:
> library(psych)
> library(likert)
> myColor <- c("red","orange", "light blue","light green", "lavender")
> levels = c("Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree")
> think$A = factor(think$A, levels, ordered = TRUE)
> think$B = factor(think$B, levels, ordered = TRUE)
> think$C = factor(think$C, levels, ordered = TRUE)
> think$D = factor(think$D, levels, ordered = TRUE)
> think$E = factor(think$E, levels, ordered = TRUE)
> think$F = factor(think$F, levels, ordered = TRUE)
> results <- likert(think)
> plot(results, col = myColor) #Have not used this yet because of the error above
【问题讨论】:
-
当数据位于某个外部站点时,很难帮助您。请参阅how to create a reproducible example 了解如何让您的问题自给自足。如果我们无法复制/粘贴代码来运行和测试它,那么帮助您会更加耗时。
标签: r