I’m trying to find row matches with grepl. The problem is that I have thousands of patterns
I was using this:
matches = mypattern_list$names
df2 = df %>% filter(grepl(paste(matches, collapse = "|"), target_column))
But because I have thousands of patterns, I get the following error:
TRE pattern compilation error 'Out of memory'
Is there anyway of doing the same, with grepl, but using reduce and lapply for example?
Example dataframe (small version)
mypattern_list= read.table(text="Names
a
b
c
d
e
f
g
h
i
etc_up_to_10000", sep="t", header=TRUE)
df= read.table(text="target column
a
BBBNNKaDDAS
b
NOPTTRNFOUND
etc_up_to_10000", sep="t", header=TRUE)