title: Merge two lists of dataframes
body: <p>I have two big lists of dataframes that I want to merge. Here is a sample of the data.</p>
  
  <pre><code>list1 = list(data.frame(Wvlgth = c(337, 337.5, 338, 338.5, 339, 339.5),
              Global = c(".9923+00",".01245+00", ".0005+00", ".33421E+00", ".74361+00", ".129342+00"),
              group = c(0,0,0,0,0,0)),
              data.frame(Wvlgth = c(337, 337.5, 338, 338.5, 339, 339.5),
              Global = c(".1284+00",".0098+00", ".7853+00", ".2311+00", ".1211+00", ".75345+00"),
              group = c(1,1,1,1,1,1)))
  
  list2 = list(data.frame(Wvlgth = c(337, 337.5, 338, 339),
                  time = c("13.445","13.445", "13.445", "13.445"),
                  IRD = c(.01324, .34565, .92395, .67489)),
                  data.frame(Wvlgth = c(337, 337.5, 338, 339),
                  time = c("13.45361","13.45361", "13.45361", "13.45361"),
                  IRD = c(.20981, .98703, .54092, .38567)))
  </code></pre>
  
  <p>I want to merge each dataframe of list1 with each dataframe of list2, by "Wvlgth", to get something like this:</p>
  
  <pre><code>Wvlgth    time      IRD        Global      group
  337       13.445    0.01324    .9923+00        0
  337.5     13.445    0.34565    .01245+00       0
  338       13.445    0.92395    .0005+00        0
  339       13.445    0.67489    .74361+00       0
  337       13.45361  0.20981    .1284+00        1
  337.5     13.45361  0.98703    .0098+00        1
  338       13.45361  0.54092    .7853+00        1
  338.5     13.45361  0.38567    .2311+00        1
  </code></pre>
  
  <p>I want to use an inner join because the dataframes of list1 don't have the same number of rows as the dataframes of list2.</p>
  
  <p>I tried the accepted answer using <code>dplyr</code> from <a href="https://stackoverflow.com/questions/8091303/simultaneously-merge-multiple-data-frames-in-a-list">this question,</a> but it ended up merging them in a weird way, I'm not quite sure what happened. It looks like it merged them horizontally instead of vertically...?</p>
  
  <pre><code>&gt; c(list1, list2) %&gt;%
        Reduce(function(dtf1, dtf2) inner_join(dtf1, dtf2, by="Wvlgth"), .)
  
    Wvlgth  Global.x group.x Global.y group.y time.x   IRD.x   time.y
  1  337.0  .9923+00       0 .1284+00       1 13.445 0.01324 13.45361
  2  337.5 .01245+00       0 .0098+00       1 13.445 0.34565 13.45361
  3  338.0  .0005+00       0 .7853+00       1 13.445 0.92395 13.45361
  4  339.0 .74361+00       0 .1211+00       1 13.445 0.67489 13.45361
      IRD.y
  1 0.20981
  2 0.98703
  3 0.54092
  4 0.38567
  </code></pre>