My dataset, very roughly, looks like this:
Variable 1 Group 1a) Group 1b) Group 2a) ...(up to 9)
yes 0 ... ... ...
no 1
yes 1
no 0
... ...
I would like to create a stacked bar chart with the groups on the x-Axis, Variable one being stacked (yes/no) and the count on the y-Axis. It is to illustrate the relationship between working, being supported by ones parents and having time for leisure activities. Example Group 1a stands for "Yes, I have time for leisure and my parents support me financially" while Group 1b) stands for "Yes, I have time for leisure and my parents don't support me financially" and on it goes. There are 9 groups in total. Variable 1 are the answers to the question "Do you work?" in a yes or no format. I am trying to follow this code example online:
#create data frame
df <- data.frame(team=rep(c('A', 'B', 'C'), each=3),
position=rep(c('Guard', 'Forward', 'Center'), times=3),
points=c(14, 8, 8, 16, 3, 7, 17, 22, 26))
#view data frame
df
team position points
1 A Guard 14
2 A Forward 8
3 A Center 8
4 B Guard 16
5 B Forward 3
6 B Center 7
7 C Guard 17
8 C Forward 22
9 C Center 26
library(ggplot2)
ggplot(df, aes(fill=position, y=points, x=team)) +
geom_bar(position='stack', stat='identity')

see link (https://www.statology.org/stacked-barplot-in-r/)
But I don't know what my corresponding group would be for "points", since these would be the values (0/1) in each group. I appreciate any help you can give me. I am fairly new to R Studio and I am still struggling with finding my way.