In my dataset, I have a categorical variable Race with three values (1,2,3), but I'd like to select only values 1 and 2. I get different results using the %in% operator and == operator. I'm confused which one is correct and what actually these two operators do (i.e., their difference). Example code:
dfData1 <- dfData1 %>% filter(race %in% c(1,2))
dfData2 <- dfData2 %>% filter(race==c(1,2))
I appreciate your help.