1
我正在尝试使用RStdudio v1.0.153生成一个带有likert刻度数据的R图。我收到以下错误:R(likert)包的问题
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
这是很难帮助你当数据位于一些外部网站。请参阅[如何创建一个可重现的示例](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example),让您的问题自给自足。如果我们无法复制/粘贴代码来运行和测试代码,那么帮助您会花费更多时间。 – MrFlick