title: Partial string matching between two columns in R
body: <p>I'm trying to verify that the emails for a list are correct. I was thinking I could do a partial string match between Email and Name columns, and return a logical vector (TRUE/FALSE) in a new column. </p>
  
  <p>In the example below, only rows 3 and 5 have correct emails, and the output would be 'TRUE' for these rows. I tried the following, and it hasn't worked:</p>
  
  <pre><code>&gt;for (i in Test$LastName) {
   Test$Match &lt;- agrepl(i, Test$Email, ignore.case = TRUE)
  }
  
  &gt;Test$Email %in% Test$LastName
  </code></pre>
  
  <p>Any other suggestions are welcome too. Thanks!</p>
  
  <p><a href="https://i.stack.imgur.com/1gQrg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1gQrg.png" alt="enter image description here"></a></p>