title: How to cast a list to a data frame with unequal columns names, base R only
body: <p>I have read</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/4512465/what-is-the-most-efficient-way-to-cast-a-list-as-a-data-frame?rq=1">What is the most efficient way to cast a list as a data frame?</a></li>
  <li><a href="https://stackoverflow.com/questions/4227223/convert-a-list-to-a-data-frame/4227483#4227483">Convert a list to a data frame</a></li>
  </ul>
  <p>I have a list with unequal columns names which I try to convert to a data frame, with NA for the missing entries in the shorter rows. It is easy with tidyverse (for example with bind_rows), but this is for a low level package that should use base R only.</p>
  <pre><code>mylist = list(
    list(a = 3, b = &quot;anton&quot;),
    list(a = 5, b = &quot;bertha&quot;),
    list(a = 7, b = &quot;caesar&quot;, d = TRUE)
  )
  # No problem with equal number of columns
  do.call(rbind, lapply(mylist[1:2], data.frame))
  
  # The list of my names
  unique(unlist(lapply(mylist, names)))
  
  # rbind does not like unequal numbers
  do.call(rbind, lapply(mylist, data.frame))
  
  
  
  </code></pre>