I have a data frame like this:
ID Word
1 Tree
1 House
1 Tree
2 Snail
2 Tree
3 Car
And I have a list of keywords I want to check for:
(House, Tree, Bird)
I want to know how many times for each ID, any word in my list of keywords appears.
I.e. the word House, Tree or Bird appears 3 times in ID(1), and House, Tree or Bird appears only once in ID(2), and there are no occurrences in ID(3)
ID Count
1 3
2 1
3 0
I am not sure how to tackle this. I know how to count the number of times a word appears within each ID, but not how many times the words from another list appear.
Thank you for any suggestions/guidance etc.