# likert Package

3 messages
Open this post in threaded view
|

## likert Package

 R- Help Forum   Working with the "likert" package and I can't figure out why my "bar" graphs are backwards (see attached). The percentages are place correctly but the bars are backwards.   #Sample code # libraries library(likert)   # create data band <- c("Band 3","Band 3","Band 3","Band 3","Band 3","Band 3","Band 3","Band 3","Band 3","Band 3",           "Band 4","Band 4","Band 4","Band 4","Band 4","Band 4","Band 4","Band 4","Band 4","Band 4") q1 <- factor(c(1,1,2,2,2,2,1,1,1,2,1,1,1,1,1,3,2,1,1,1),levels = c("1","2","3")) q2 <- factor(c(1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1),levels = c("1","2","3")) q3 <- factor(c(2,2,2,2,2,2,2,2,2,2,1,3,2,2,2,2,2,2,2,2),levels = c("1","2","3")) q4 <- factor(c(3,3,3,3,3,3,3,3,2,1,2,2,3,3,3,3,3,3,3,3),levels = c("1","2","3")) q5 <- factor(c(2,2,2,2,3,1,1,2,2,2,2,3,3,3,3,3,3,1,1,3),levels = c("1","2","3"))   df <- data.frame(band,q1,q2,q3,q4,q5)   summary(df) results <- likert(df[,2:6]) summary(results)   # bar plot, this plots correctly plot(results, type="bar")   # group by 'Band Level', this plots the bars backwards results <- likert(df[,2:6], grouping = df\$band) plot(results, type = "bar", centered = FALSE, group.order = c("Band 3", "Band 4"))   ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. Figure.png (21K) Download Attachment