Probably not the simplest solution, but I just created a function to set the levels in the correct order and applied it to each variable. I did not install the likert package to see if the plot is now correct.
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
# Here is a simulation:
itemshr <- data.frame(stringsAsFactors = F,
Q2_1 = c("Strongly agree","Disagree","Neutral","Agree", "Strongly disagree"),
Q2_2 = c("Strongly disagree","Disagree","Neutral","Agree", "Strongly agree"),
Q2_3 = c("Neutral","Disagree","Strongly disagree","Agree", "Strongly agree"))
factor_likert <- function(x){
factor(x, levels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))
}
itemshr1 <- itemshr %>%
mutate(across(everything(), factor_likert))
str(itemshr1)
#> 'data.frame': 5 obs. of 3 variables:
#> $ Q2_1: Factor w/ 5 levels "Strongly disagree",..: 5 2 3 4 1
#> $ Q2_2: Factor w/ 5 levels "Strongly disagree",..: 1 2 3 4 5
#> $ Q2_3: Factor w/ 5 levels "Strongly disagree",..: 3 2 1 4 5
Created on 2022-05-07 by the reprex package (v2.0.1)