title: How to unlist an arbitrary level in R nested list?
body: <p>I have a nested list that has three levels. I need to unlist the middle level, but I have not found an easy way to do it.</p>
  
  <p>E.g.</p>
  
  <pre><code>df1 &lt;- data.frame(X = sample(100),
                    Y = sample(100))
  df2 &lt;- data.frame(X = sample(50),
                    Y = sample(50))
  df3 &lt;- data.frame(X = sample(150),
                    Y = sample(150),
                    Z = sample(150)) 
  df4 &lt;- data.frame(X = sample(20),
                    Y = sample(20),
                    Z = sample(20))
  
  list1 &lt;- list(A = df1, B = df2)
  list2 &lt;- list(A = df3, B = df4)
  
  masterList &lt;- list(list1, list2)
  </code></pre>
  
  <p>What I want to achieve is</p>
  
  <pre><code>newMasterList &lt;- list(A = rbind(df1,df2), B = rbind(df3,df4))
  </code></pre>
  
  <p>I've tried unlist() with the both recursive options but they don't yield the desired result:</p>
  
  <pre><code>newMasterListFAIL1 &lt;- lapply(seq_along(masterList), function(x) unlist(masterList[[x]], recursive = F))
  
  newMasterListFAIL2 &lt;- lapply(seq_along(masterList), function(x) unlist(masterList[[x]]))
  </code></pre>