I need your help!
I want to add labels to a bar plot of the average 'Monthly_Fee' grouped by 'User_Gender' and 'Has_Children'. This means that we are dealing with a continuous dependent variable and two binary independent variables. I would really appreciate your input on how to add data labels on top of the bars showing the mean for each group.
I have used the following code to generate the bar plot:
plot_001 <- ggplot(data = df, mapping = aes(x = Has_Children, y = Monthly_Fee)) +
geom_bar(stat = "summary", fun = "mean") +
labs(title = "'Monthly_Fee' by 'User_Gender' and 'Has_Children'", x = "Has Children (Yes or No)", y = "Monthly fee ($)",) +
facet_wrap(vars(User_Gender), scales = "free", nrow = 1, strip.position = "top")
I have tried to add the following code in order to add the data labels: "geom_text(aes(label = Monthly_Fee)) +". However, it is displaying data labels for ALL rows in the dataset, which is not preferred as I only want it to display the mean value for the group.