頭の体操
> target[unique(c(sapply(pattern, function(x) grep(x, target))))]
[1] "abaa" "abef" "aefe"