Hi Nicole!
I think that there are two solutions.
One is convert into a factor the variable Pref before plotting it.
prefsAB$Pref <- factor(prefsAB$Pref)
The second solution is write the argument stringsAsFactors = TRUE in the read.csv() function.
prefsAB <- read.csv("prefsAB.csv", stringsAsFactors = TRUE)
This is because in the versions equal or bigger than R 4.0.0, read.csv() and the others functions for import data don't coerce into factors the strings. Maybe your teacher made this exercise before these actualizations.
You're welcome.
Cheers!