Context
Let’s say we are interested in predicting the gender of a candidate for the
British General Elections in 1992 by using the Political Parties as a predictor.
We have the next data:

library(dplyr)
library(tidyr) elections <- tibble( party = c("Tories", "Labour", "LibDem", "Green", "Other"), women = c(57,126,136,60,135), men = c(577,508,496,192,546)
) elections
## # A tibble: 5 × 3

party women men

<chr> <dbl> …