I would like to add for my ggplot boxplot a mean with a legend, but I don't know how.
The follwing R script is include in a function for a single variable:
p2 <- ggplot(df, aes("",!!sym(x))) +
    geom_boxplot() +
    stat_summary(fun=mean, geom="crossbar", color="steelblue2") 
    
Thanks.
 
    