title: Left join with two unique conditions in R
body: <p>Apologies if this has been answered before, I had a look but could not find a workable solution in any other thread.
  I have two large(&gt;600k rows on 45 columns) datasets, which I have to merge based on two conditions.
  The logic is as follows:</p>
  <p>tmp0:</p>
  <pre><code>  id     date    value1
  1  001   200001  1
  2  001   200002  1.5
  3  001   200003  0.75
  4  002   200001  1
  5  002   200002  1.58
  6  002   200003  0.5
  </code></pre>
  <p>tmp1:</p>
  <pre><code>  id     date    value2
  1  001   200001  3
  2  001   200002  2.5
  3  001   200003  0.5
  4  002   200001  0.25
  5  002   200002  1
  6  002   200003  0.85
  </code></pre>
  <p>I simply want to merge them on conditions id and date, creating something like.</p>
  <pre><code>  id     date    value1 value2 
  1  001   200001  1       3
  2  001   200002  1.5     2.5
  3  001   200003  0.75    0.5
  4  002   200001  1       0.25
  5  002   200002  1.58    1
  6  002   200003  0.5     0.85
  </code></pre>
  <p>As they are not in perfect order as above, I can not use rbind to simply merge.</p>
  <p>I tried</p>
  <pre><code>tmp2 &lt;- left_join(tmp0, tmp1, by=c(&quot;id&quot;,&quot;date&quot;))
  </code></pre>
  <p>but it gives me a 12x4 matrix rather than a 6x4...</p>
  <p>Any suggestions, highly appreciated.</p>
  <p>Thanks and best,
  D.</p>