I have a list of people and their group and age in a table similar to the example below. I would like to draw a grouped bar chart based on age range.
Group Age
1 G1 29
2 G2 25
3 G3 55
4 G2 33
5 G1 70
6 G3 80
I tried the following syntax given here, but not sure how to divide the plots into three groups and age ranges within each group
df<- mutate(df, age_class = cut(Age, breaks = seq(20, 80, by = 10)))
ggplot(df) + geom_bar(aes(x = age_class, fill = Group), position = "dodge") + scale_fill_manual(values = c("red", "blue", "green"))