Hi all, I have a large data frame and would like to make a barplot of a categorical variable with the bars sorted in order of decreasing frequency.
# Example: v1 = c(1.2, 1.4, 0.9, 1.0, 1.1, 1.0) v2 = c("aa", "cc", "bb", "bb", "cc", "bb") v3 = c(8, 10, 11, 9, 9, 10) df = data.frame(v1=v1, v2=v2, v3=v3) # How can I tell ggplot to sort the bars? # First bar = "bb" (3), second bar "cc" (2) and third bar "aa" (1) p = gplot(df) p + aes(v2) + geom_bar() Thank you, Morten -- View this message in context: http://r.789695.n4.nabble.com/ggplot2-barplot-in-decreasing-frequency-tp2964511p2964511.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.