Here you can use match()c mapply()to find the first column by dividing the column yinto pieces. Then we can build a second column based on this.
df$pos <- mapply(match, df$x, strsplit(df$y, ",", fixed = TRUE), USE.NAMES = FALSE)
df$contains <- replace(!is.na(df$pos), is.na(df$y), NA)
which gives
x y pos contains
1 a b,c,d NA FALSE
2 c b,c,d 2 TRUE
3 c b,c,d 2 TRUE
4 a e,f,g NA FALSE
5 a b,c,d NA FALSE
6 c a,b,c 3 TRUE
7 b b,c,d 1 TRUE
8 c <NA> NA NA
9 c e,f,g NA FALSE
10 a <NA> NA NA
source
share