How can I test which element of a character vector (testvec) has the most words from another character vector (matchvec)?
testvec <- c("making words up here for a test significant words",
"this one is really important and significant/crucial",
"can you see which has most significant/important words?",
"this one isn't desired at all")
matchvec <- c("important", "significant", "crucial")
desired_result (since the second from testvec has the most words from matchvec)
[1] 2
If I change it so that two have the same max I want to return both indexes:
matchvec2 <- c("important", "significant")
desired_result2 (since the second/third from testvec have the most words from matchvec2)
[1] 2
[2] 3