Hi all I have a large dataframe with (among others) a categorical variable of 52 levels and would like to create a barplot with the bars ordered in decreasing frequency of the levels. I belive it is referred to as a pareto plot.
Consider a subset where I keep only the categorical variable in question. # Example: v1 = c("aa", "cc", "bb", "bb", "cc", "bb") df = data.frame(v1=v1) # How can I tell ggplot to sort the bars? # First bar = "bb" (3), second bar "cc" (2) and third bar "aa" (1) # with 52 levels in the real data frame (many with equal counts) # and other similar variables, I hope it is possible to script this efficiently ggplot(df) + geom_bar(aes(v1)) Thank you in advance Morten -- View this message in context: http://r.789695.n4.nabble.com/ggplot2-Pareto-plot-Barplot-in-decreasing-frequency-tp2965796p2965796.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.