I am trying to do something like the first solution here:
give.n <- function(x){
return(c(y = mean(x), label = length(x)))
}
ggplot(diamonds, aes(cut, price)) +
geom_boxplot() +
stat_summary(fun.data = give.n, geom = "text")
But I want those sample sizes to be displayed at position y = 0, not in the boxes of the boxplots. How do I do this?