I am looking for a function that takes a dataframe column, checks to see if it contains text from a row vector, and filters it after matching (including partial text matching).
For example, take the following data frame:
animal |count aardvark |8 cat |2 catfish |6 dog |12 dolphin |3 penguin |38 prairie dog|59 zebra |17
and the next vector
c("cat", "dog")
I would like to run through the βanimalβ column, checking whether this value fully or partially matches one of the lines in the vector, and filter out those that are not. Resulting data frame:
animal |count cat |2 catfish |6 dog |12 prairie dog|59
Thanks!
Sean
source share