How to add frequency count labels to the bars in a bar graph using ggplot2? [duplicate]
问题 This question already has an answer here: Show frequencies along with barplot in ggplot2 5 answers I want to plot frequency distribution of an [r] factor variable as a bargraph, where bars represent the frequency counts of the factor levels. I use ggplot2 to do that and there's no problem with that. What I can't figure out is how to add frequency count labels to the bars in the bargraph. The syntax that I've tried is as follows: ggplot(data, aes(x = factorvar)) + geom_bar(fill = "somecolor")