I have 2 data sets, say A and B, I want to add a column to A that has Y or N on weather A$4 matches B$5 and or B$6.
I tried
A %>%
add_column(Match = ifelse(A$4 %in% c(B$5, B$6), Y, N))
However B$5 and B$6 sometimes contain multiple options, separated by a comma.
For example, if a value in A$4 is (CR2), and a value in B$5 is (CR6) and B$6 is (CR1,CR2), I still want the A$Match to be Y. And using the %in% operator only gives Y for an exact match.
I ended up getting some help from a collegue, since the datasets arent too big we opted to loop through the data.