Sorry for the long delay, apparently the site was down for a day?
Here's an alternate base R solution.
x <- sample(40:100, 60, TRUE)
grade <- function(x,
grades = c("F", "D", "C", "B", "A"),
bound = c(-Inf, 60, 70, 80, 90, Inf)) {
cut(x, bound, grades)
}
df <- data.frame(raw_score = x, grade = grade(x))
head(df)