I find countless examples of reordering X by the corresponding size of Y if the Dataframe for ggplot2 (geom_bar)
is read using stat="identity"
.
I have yet to find an example of stat="count"
. The reorder function fails as I have no corresponding y
.
I have a factored DF of one column, "count"
(see below for a poor example), where there are multiple instances of the data as you would expect. However, I expected factored data to be displayed:
ggplot(df, aes(x=df$count)) + geom_bar()
by the order defined from the quantity of each factor, as it is different for unfactored (character
) data i.e., will display alphabetically.
Any idea how to reorder?
This is my current awful effort, sadly I figured this out last night, then lost my R command history: