Describing the relationships between two categorical variables is done somewhat less often than the other two broad types of bivariate analyses, but it is just as fun (and useful)!
To explore this technique, we will be using the UCBAdmissions dataset, which contains the data on graduate school applicants to the University of California Berkeley (UCB) in 1973.
Before we get started, we have to wrap the dataset in a call to data.frame to coerce it into a data frame type variable—I'll explain why, soon:
ucba <- data.frame(UCBAdmissions) head(ucba) Admit Gender Dept Freq 1 Admitted Male A 512 2 Rejected Male A 313 3 Admitted Female A 89 4 Rejected Female A 19 5 Admitted Male B 353 6 Rejected Male B 207
Now, what we want is a count of the frequencies of...