I'm trying to plot data from a study that used a Likert-scale measurement. I am using the 'Likert' package. The problem I have occurs when I try to group the data in the plot. For illustratation, I will demonstrate using a dataset that is used in many of the online demos such as
this one
When I run the code, I want/expect a graph that looks like this (notice that the bar plots are organised in a nice ordered sequence from 'strongly disagree' to 'strongly agree'):
When I run the following code, I get a graph where the order is confused; mainly 'agree' and 'strongly agree' are swapped around. Can anyone shed some light as to why this might be happening and how I can fix it? Any help would be greatly appreciated.
require(likert)
library(plyr)
##### import built-in data
data(pisaitems)
# extract data for analysis
items24 <- pisaitems[,substr(names(pisaitems), 1,5) == 'ST24Q']
# rename cols
items24 <- rename(items24, c(
ST24Q01="I read only if I have to.",
ST24Q02="Reading is one of my favorite hobbies.",
ST24Q03="I like talking about books with other people.",
ST24Q04="I find it hard to finish books.",
ST24Q05="I feel happy if I receive a book as a present.",
ST24Q06="For me, reading is a waste of time.",
ST24Q07="I enjoy going to a bookstore or a library.",
ST24Q08="I read only to get information that I need.",
ST24Q09="I cannot sit still and read for more than a few minutes.",
ST24Q10="I like to express my opinions about books I have read.",
ST24Q11="I like to exchange books with my friends."))
# capture Likert data by group
l24g <- likert(items24[,1:11], grouping=pisaitems$CNT)
# plot
plot(l24g)