LBes
LBes

Reputation: 3456

Change order of plotting in Likert Scale

I am trying to change the order in which my Likert items are being plotted with the Likert package and so far I haven't been very successful. Let's consider the following minimal code to reproduce my error. I would like to see plotting with a specific custom (or at least Question 1 to Question 4, top to bottom) ordering. I have tried several things (based on some questions and answers on here), and all failed.

First the data:

question1<- c(1,5,3,4,1,1,1,3,4,5)
question2<- rev(c(1,5,3,4,1,1,1,3,4,5))
question3<- c(1,1,1,2,2,2,3,3,4,5)
question4<- c(5,5,5,4,4,4,3,3,2,1)
testData<-data.frame(question1,question2,question3,question4)
testData <- lapply(testData, factor, levels= c(1:5), ordered = TRUE)
testData <- as.data.frame(testData)

Then plotting attempt #1:

p <- (likert(testData))
plot(p)

Gives me the following:

Plotting attempt 1

Plotting attempt number 2 (close enough but order is reversed and this does not give me a solution for any random ordering):

p <- (likert(testData))
plot(p, ordered=FALSE)

Gives me this:

Plotting attempt 2

Plotting attempt #3:

p <- (likert(testData))
p$Item <- factor(p$Item, levels = rev(c("question1", "question2", "question3", "question4")))
plot(p)

Also does not work. Would anyone have any idea how to solve this?

Thanks in advance.

Upvotes: 1

Views: 2415

Answers (1)

LBes
LBes

Reputation: 3456

Ok turns out I found the answer, doing the following works:

p <- (likert(testData))
plot(p, group.order = c("question1", "question2", "question3", "question4"))

Upvotes: 5

Related Questions