# A tibble: 6 × 7
No Region District `Name of School` Male Female Total
<chr> <fct> <fct> <chr> <dbl> <dbl> <dbl>
1 1 South East Gaborone Bokamoso CJSS 545 516 1061
2 2 South East Gaborone Marang CJSS 550 567 1117
3 3 South East Gaborone Nanogang CJSS 493 558 1051
4 4 South East Gaborone Maikano CJSS 440 388 828
5 5 South East Gaborone Motswedi CJSS 443 475 918
6 6 South East Gaborone Gaborone West 415 401 816
i want to declare and add a new categorical variable Gender to my data. the gender variable should depend on the values of males and females already provided in the dataset. The point is to plot a grouped bar chart where Region is divided into gender categories in the x axis
# A tibble: 6 × 7
No Region District `Name of School` Male Female Total
<chr> <fct> <fct> <chr> <dbl> <dbl> <dbl>
1 1 South East Gaborone Bokamoso CJSS 545 516 1061
2 2 South East Gaborone Marang CJSS 550 567 1117
3 3 South East Gaborone Nanogang CJSS 493 558 1051
4 4 South East Gaborone Maikano CJSS 440 388 828
5 5 South East Gaborone Motswedi CJSS 443 475 918
6 6 South East Gaborone Gaborone West 415 401 816

You need to learn
tidydata principles firstCreated on 2024-03-07 with reprex v2.0.2