Hi,
Welcome to the RStudio community!
I agree with @williaml that you should have a look at how to build a reprex to better share your data. But given this is your first time posting here, and the problem is relatively easy, I was able to quickly create some fake data and show a way to solve it
library(dplyr)
set.seed(1)
myData = data.frame(
Gender = sample(c("Male", "Female"), 5, replace = T),
Number = sample(1:20, 5)
)
myData
#> Gender Number
#> 1 Male 11
#> 2 Female 14
#> 3 Male 18
#> 4 Male 1
#> 5 Female 5
myData %>% group_by(Gender) %>%
summarise(total = sum(Number), .groups = "drop")
#> # A tibble: 2 x 2
#> Gender total
#> <chr> <int>
#> 1 Female 19
#> 2 Male 30
Created on 2021-11-22 by the reprex package (v2.0.1)
Hope this helps,
PJ