R data frame string contains: Does column 1 contain column 2?
问题 I have a dataframe with two columns: Surname Email 1 house greghouse@gmail.com 2 wilson johnwatson@gmail.com I want to create a logical vector which checks if Surname is contained in Email . The result should therefore be: Surname Email CheckEmail 1 house greghouse@gmail.com TRUE 2 wilson johnwatson@gmail.com FALSE I tried grep but it seems that grep can only look for one pattern in 1 or more instances. I specifically need to look for multiple patterns in multiple instances . > grep(df1