title: merge 2 dataframe with same but different case column in R
body: <p>I have two dataframes but issue is the merge &quot;by&quot; column has values in different cases.</p>
  <p>sn1capx1e0001 vs SN1CAPX1E0001.</p>
  <pre><code>authors &lt;- data.frame(
  surname = I(c(&quot;Tukey&quot;, &quot;Venables&quot;, &quot;Tierney&quot;, &quot;Ripley&quot;, &quot;McNeil&quot;)),
  nationality = c(&quot;US&quot;, &quot;Australia&quot;, &quot;US&quot;, &quot;UK&quot;, &quot;Australia&quot;),
  deceased = c(&quot;yes&quot;, rep(&quot;no&quot;, 4)))
  
  books &lt;- data.frame(
  name = I(c(&quot;tukey&quot;, &quot;venables&quot;, &quot;tierney&quot;,
             &quot;tipley&quot;, &quot;ripley&quot;, &quot;McNeil&quot;, &quot;R Core&quot;)),
  title = c(&quot;Exploratory Data Analysis&quot;,
            &quot;Modern Applied Statistics ...&quot;,
            &quot;LISP-STAT&quot;,
            &quot;Spatial Statistics&quot;, &quot;Stochastic Simulation&quot;,
            &quot;Interactive Data Analysis&quot;,
            &quot;An Introduction to R&quot;),
  other.author = c(NA, &quot;Ripley&quot;, NA, NA, NA, NA,
                   &quot;Venables &amp; Smith&quot;))
  m1 &lt;- merge(authors, books, by.x = &quot;surname&quot;, by.y = &quot;name&quot;)
  </code></pre>
  <p>gives</p>
  <blockquote>
  <p>surname  nationality deceased title                     other.author</p>
  <p>McNeil   Australia   no       Interactive Data Analysis  NA</p>
  </blockquote>
  <p>So I want to merge them by being case insensitive. I couldnt use merge or join.</p>
  <p>I saw we can use regex to match values using loops.</p>