I have two character vectors:
x = {"a", "b", "c", "kt"}
y = {"abs", "kot", "ccf", "okt", "kk", "y"}
I need to use x to delete entries from y so that only rows that do not contain any of the x entries are left, for example:
y = {"kot", "kk", "y"}
The code should work for any size of the vectors x and y.
So far, I have tried using gsub and grepl, but they only work on single lines. I tried to create a loop for this, but the problem seems more complicated than I thought. And, of course, the more complex the solution, the better, but you can assume that in this case the vectors x and y have up to 200 entries.
source
share