Hello community.
Please I need help with this code to be able to sort the categories in my chart. Rstudio sorts alphabetically and that is altering my ordinal type varibale. Any suggestion in my code, please?
#Gráfico más elaborado que incluye resultado del test Kruskal Wallis
my_comparisons2 <- list(c("Viajes Cortos", "Viajes Largos"),c("Viajes Cortos","Viajes Medianos"),c("Viajes Cortos","Viajes muy Largos"),c("Viajes Largos","Viajes Medianos"),
c("Viajes Largos","Viajes muy Largos"),c("Viajes Medianos","Viajes muy Largos"))
ggboxplot(bienestaranimal, x = "Tiempo", y = "Pérdidas_económicas",
color = "darkblue", palette = "jco",ordered = TRUE,
xlab = "Tiempo de viaje" ,ylab = "Pérdidas económicas",
)+
stat_compare_means(comparisons = my_comparisons2, label.y = c(13,14.5,16,17.5,19,20.5))+
stat_compare_means(label.y = 20.5)