I am obtaining 2 different results from my data using the sjp.likert command, this is my code:
library(sjPlot)
l <- c(1,2,2,2,3,3,4,4,5,5,5,4,3,2,2)
lab <- c("strongly not agree",
"not agree",
"Neutral",
"Agree",
"Strongly agree")
sjp.likert(items = l,
cat.neutral = 3,
catcount = 4,
legend.labels = lab)
notice that i am working with a numeric variable not factor, at this point everything looks ok, but sometimes i prefer to work with factor to omit the legend.labels parameter. So i use this
l.factor <- factor(x = l,labels = lab)
sjp.likert(items = l.factor,
cat.neutral = 3,
catcount = 4)
But this is where i get the problem, for example: the "neutral" response is not longer 20%, now is 6.7%. As far i can see the package is reading the "neutral" response as neutral, because the grey color in right side.
You can see that the proper number is 20% using this
prop.table(table(l.factor))
prop.table(table(l))
What i am doing wrong? is this a bug?