I\'m plotting a categorical variable and instead of showing the counts for each category value.
I\'m looking for a way to get ggplot
to display the perc
As of March 2017, with ggplot2
2.2.1 I think the best solution is explained in Hadley Wickham's R for data science book:
ggplot(mydataf) + stat_count(mapping = aes(x=foo, y=..prop.., group=1))
stat_count
computes two variables: count
is used by default, but you can choose to use prop
which shows proportions.