title: How to join two dataframes with dplyr based on two columns with different names in each dataframe?
body: <p>This is a really simple question, but can't find a suitable answer here.</p>
  
  <p>How does one join two data.frames with <code>dplyr</code> based on <strong>two columns</strong> with different names in each data.frame?</p>
  
  <p>With <code>base::merge</code> one can simply <code>merge</code>:</p>
  
  <pre><code>df3 &lt;- merge(df1, df2, by.x=c("name1", "name2"), by.y=c("name3", "name4"))
  </code></pre>
  
  <p>where <code>df1$name1 == df2$name3</code> and <code>df1$name2 == df2$name4</code>.</p>
  
  <p>How does one do this in <code>dplyr</code>?</p>
  
  <hr>
  
  <p>I know that one can use the <code>by</code> function in <code>dplyr</code> to do join two data.frames with based on one column with a different name:</p>
  
  <pre><code>df3 &lt;- dplyr::left_join(df1, df2, by=c("name1" = "name3"))
  </code></pre>