agregat

# aggregate by gender. Note: na.rm = TRUE
#summarize = new column sum

a1 <- data %>% group_by(gndr) %>% 
  summarise(n_stflife = n(), mean_stflife = mean(stflife, na.rm = TRUE))

a2 <- data %>% group_by(gndr, cntry) %>% 
  summarise(n_stflife = n(), mean_stflife = mean(stflife, na.rm = TRUE))
Diana H