I am looking to create a new column from the intersecting words from two other columns containing strings:
sometext1 <- c('this is a text entry','here is another text entry','something else')
sometext2 <- c('text entry','text entry','no match here')
texts <- data.frame(sometext1=sometext1, sometext2=sometext2,stringsAsFactors=F)
This is my attempt that didn't produce any match:
texts$common <- paste(Reduce(intersect, list(strsplit(texts$sometext1,' '), strsplit(texts$sometext2,' '))), sep=" ", collapse=" ")
texts$common should look something like this:
1 'text entry'
2 'text entry'
3 ''
Thanks!!