I am trying to categorize variables in a column based on loans. If the loan is fully paid then it should labeled as good, if default or charged off then labeled as bad. However when i run the code below in R, i get this error:
Error: Problem with `mutate()` input `new_status`. x must be a character vector, not a logical vector. ℹ Input `new_status` is `case_when(...)`.
Here is the code block
loans <- loansdf %>% mutate(new_status = case_when(
status %in% c("Fully paid") ~ "Good",
status %in% c("Default", "Charged off") ~ "Bad",
TRUE ~ NA))