How to count the number of matched strings in R, when the string pattern to match is a column from another dataframe?
4
I have got two extremely large dataframes, the first data frame consists of a column body , which is a list of comments and the second one consists of names . I want to count how many elements in body contain each element of names . Here's a small reproducible dataset (the original dataset has about 2000 names, where each name is a name of the car): df1 <- tibble(body = c("The Tesla Roadster has a range of 620 miles", "ferrari needs to make an electric car", "How much does a tesla cost?", "When is the new Mercedes releasing?", "Can't wait to get my hands on the new Tesla")) df2 <- tibble(names = c("FORD...