I have a following code, where I would like to do a bar plot from XXX dataset, where X2 variable is sorted:
XXX %>% arrange(desc(X2)) %>%
ggplot(aes(x = X1, y = X2)) +
geom_bar(stat = "identity", width = 0.75) +
coord_flip()
Why it does not work? I have the same plot like without arrange(desc(X2)). I know already how to do the arrangement, but I would like to understand why it is not an appropriate solution.