title: R: Combining Nested List Elements by Name
body: <p>Let's say I have a list structure where there are <code>data.frames</code> nested in each element.</p>
  
  <pre><code>l &lt;- list(A = list(D = data.frame(V1 = seq(3), V2 = LETTERS[1:3]),
                     E = data.frame(V1 = seq(3), V2 = LETTERS[4:6])),
            B = list(D = data.frame(V1 = seq(3), V2 = LETTERS[7:9]),
                     E = data.frame(V1 = seq(3), V2 = LETTERS[10:12])))
  
  $A
  $A$D
    V1 V2
  1  1  A
  2  2  B
  3  3  C
  
  $A$E
    V1 V2
  1  1  D
  2  2  E
  3  3  F
  
  
  $B
  $B$D
    V1 V2
  1  1  G
  2  2  H
  3  3  I
  
  $B$E
    V1 V2
  1  1  J
  2  2  K
  3  3  L
  </code></pre>
  
  <p>I would like to find a way to combine the <code>D</code> and <code>E</code> <code>data.frames</code> respectively from the parent list elements (<code>A</code>,<code>B</code>) so the output would be like this:</p>
  
  <pre><code>$D
    V1 V2
  1  1  A
  2  2  B
  3  3  C
  4  1  G
  5  2  H
  6  3  I
  
  $E
    V1 V2
  1  1  D
  2  2  E
  3  3  F
  4  1  J
  5  2  K
  6  3  L
  </code></pre>
  
  <p>I can accomplish this with a loop but I am trying to find something a little more efficient/elegant.</p>
  
  <pre><code>out &lt;- vector("list", length(list))
  for(i in c("D","E")){
    out[[i]] &lt;- do.call("rbind", lapply(l, function(x) x[[i]]))
  }
  </code></pre>