I am trying to label values based on the range they fall into, the way you might with, say, grading assignments. So if I have a data frame of mean quiz scores, and a data fr
The breaks
vector has to be one element longer than the labels
vector: you need both a lower and an upper cutoff for each category. Just tack 100 (upper limit) onto the end of the breaks
vector (might need to be 100.5 if you have any scores of exactly 100 ...) As pointed out in the comment above, you should have your breaks in ascending order ...
cut(grades$Mean,
breaks = c(rev(letters$Cutoff),100),
labels = rev(letters$Letter),
right = FALSE)
## [1] A B B C F
## Levels: F D C B A