'How can I plot the mean of a feature in a barplot?
I have followed barplot example:
library(ggplot2)
df <- read.csv("https://raw.githubusercontent.com/plotly/datasets/master/violin_data.csv")
g <- ggplot(df, mapping = aes(forcats::fct_infreq(sex), fill = as.factor(size))) +
geom_bar(colour = "white") + coord_flip() +
geom_text(aes(label = paste0("n=", ..count..)), stat='count',
position = position_stack(vjust = 0.5))
g
Which gives me:
What I want is the mean of the size from the Female and the Male:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


