With the following code
A2c%>%
group_by (maritalStatus, Geschlecht)%>%
summarise (nbr_total=n(), nbr_adipos=sum(Adipös))%>%
mutate( adipos_prozent = 100 * nbr_adipos / nbr_total )%>%
filter (maritalStatus != "Refused")%>%
ggplot+
geom_col(aes(x=maritalStatus, y= adipos_prozent, color = Geschlecht, fill=Geschlecht))+
theme(axis.text.x = element_text(angle = 90))+
labs(y = "% Adipöser", x = "Marital Status")
I get this plot: image of plot
Here the woman and man are put on top of each other for each marital status. However I would like to have the bars for men and women next to each other for each marital status. So instead of having for married one bar with male and female I would like to have two bars for married, one for each gender. I have not found out how to do this. Maybe someone can help?
Maybe the table of the values is helpful: table