We can use paste
ggplot(df_full_short,aes(x=reorder(unit, paste(var1, var2)), y=dev)) +
...
Or may be change the unit
levels
based on the ‘var1’, ‘var2’
library(dplyr)
df_full_short %>%
arrange(var1, var2) %>%
mutate(unit = factor(unit, levels = unique(unit))) %>%
ggplot(aes(x = unit, y = dev)) +
...
CLICK HERE to find out more related problems solutions.