I have a dataset where one of the columns/variables is "Ethnicity", coded with 12 different racial groups. I want to recode the variable as containing three values only, since I'm only interested in "White" and "Black or African American", and want everything else to be recoded as "Other". I used the code below, but obtained the following error. I know I can enter each racial group individually ("Hispanic" = "Other", "Asian" = "Other), but is there a way to do it more efficiently? I'm sure there is, but it's beyond my R knowledge. Thanks!
New_ethnicity <- data %>%
select(Ethnicity) %>%
mutate(Ethnicity = recode(Ethnicity, !c("White", "Black or African American") = "Other"))