I have problems with the solution posted by useRj on Nov 15, 2017 at 16:59
"Likert package does not allow to do such manipulation. Heatmap is ALWAYS ordered by alphabetically sorted text. So I suggest a workaround by forcing the text to be previously sorted by the column you think the most likely to be like bar chart sorting. A bit nasty but works:
library(magrittr)
library(dplyr)
# Get the results data frame out of the list
# and sort by last column ("Strongly agree")
# padding with zeros to avoid alphabetical ordering
l24.results <- l24.reverse$results %>%
dplyr::arrange(desc(`Strongly agree`)) %>%
dplyr::mutate(Item = paste(str_pad(row_number(),2, pad = "0"), Item, sep = ' '))
# create a likert object again from the summary feature
mylikert <- likert(summary = l24.results)
# plot again
plot(mylikert, type = "heat")
When I try with my own dataset, I have the following error:
Error in data.frame(Item = results[, 1], low = low, neutral = neutral, :
object 'neutral' not found
this is the plot without sorting:
thanks