[R] likert Package

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Thu Aug 24 03:58:41 CEST 2017


Please don't start a new thread with the same question. My usual suggestion at this point would be for you to respond to the answers that have already been posted to your last question, but I think at this point that you need to correspond directly with the maintainer of the likert package. 
-- 
Sent from my phone. Please excuse my brevity.

On August 23, 2017 6:38:26 PM PDT, Jeff Reichman  <reichmanj at sbcglobal.net> wrote:
>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"))
>
> 



More information about the R-help mailing list