I am trying to reorder the levels in my stacked column (the order in which it fills the fill levels). The ggplot documentation shows this as straightforward:
w <- ggplot(diamonds, aes(clarity, fill = cut))
w + geom_bar()
w + geom_bar(aes(order = desc(cut)))
which seems to be needed by me, but when I try to run the above code, it produces this:
Error in eval (expr, envir, enc): could not find function "desc"
Is there another package I need to enable in order to get this feature, or is it now an obsolete way to do this that has been replaced? I tried reordering the factors in data.frame, but that does not change how geom_bar stacks them.
The documents I'm viewing (in RStudio) are for "[Package ggplot2 version 1.0.0 Index]"
thank