Factor basics
- A variable that records month:
x1 <- c("Dec", "Apr", "Jan", "Mar")
Problems with using a string:
- Only 12 possible values
- No way of accounting for typos
x2 <- c("Dec", "Apr", "Jam", "Mar")
- Doesn’t sort in a useful way but alphabetically
## [1] "Apr" "Dec" "Jan" "Mar"