So I have a dataframe with a column with the following letter grades: C C A B
I would like to return the value A which is the highest score, but when I run the following code it shows an error (that doesn't happen when I put numerical values)
max(df$grades, na.rm=T)
Note: I already ordered the letter grades with the following code:
df$grades <- factor(df$grades)
Note: Here's the data I used:
class <- c(
"blah1",
"blah2",
"blah4",
"blah3"
)
grades <- c("C", "C", "A", "B")
df <- data.frame(class,grades)
Any help will be greatly appreciated!