I have made a bar chart using ggplot2 showing how many employees there are in different sectors. However, when I try to add the total within each bar, it takes each variable of the Employees data instead of the total. How would I get the sum?
This is my code:
library(ggplot2) ggplot(df, aes(x = Industry_broad, y = Employees, fill = Industry_broad)) + geom_bar(stat = "identity") + theme_minimal() + theme(legend.position="none") + geom_text(aes(label=Employees), position=position_dodge(width=0.9), vjust=-0.25) ´´´