var1 is a character vector
var1 <- c("tax evasion", "all taxes", "payment")
and var2 is another character vector
var2 <- c("bill", "income tax", "sales taxes")
Want to compare var1 and var2 and extract the terms which has a partial word match, for example, the desired answer in this case will be the following character vector:
"tax evasion", "all taxes", "income tax", "sales taxes"
I tried
sapply(var1, grep, var2, ignore.case=T,value=T)
but not getting the desired answer. How can it be done?
Thanks.