Kate_low_grades is a logical, but we expected it to be a numeric

Hi there, first post.
This has come up twice now and I am not sure how to remedy it.
In both examples, my output is what I expect.
The correct subjects are listed with the corresponding grades that are < and the gpa, and the previous lesson where the ‘final_scores’ are listed that are > the gpa.
Any help appreciated.

tests <- c(76, 89, 78)
homework <- c(85, 90, 88, 79, 88, 95, 74)
projects <- c(77, 93, 87, 90, 77, 82, 80)

class_names <- c(“math”, “chemistry”, “writing”, “art”, “history”, “music”, “physical_education”)
tests <-c(tests,88,79,93,89)
kate_grades <- (tests+homework+projects)/3
names(kate_grades) <- class_names
kate_gpa <- mean(kate_grades)
kate_low_grades <- kate_grades < kate_gpa
names(kate_low_grades) <- class_names

Hi @Michael34,

Welcome to the community! I assume that the code you have provided is from this screen:

Your code is almost correct. As the answer checker is looking for kate_low_grades variable, you have to assign your last line to kate_low_grades variable like this:

kate_low_grades <- kate_grades[kate_low_grades]

I would recommend you to read this post:

It will help you to get a faster response from the community.