title: What is the most efficient way to cast a list as a data frame?
body: <p>Very often I want to convert a list wherein each index has identical element types to a data frame.  For example, I may have a list:</p>
  
  <pre><code>&gt; my.list
  [[1]]
  [[1]]$global_stdev_ppb
  [1] 24267673
  
  [[1]]$range
  [1] 0.03114799
  
  [[1]]$tok
  [1] "hello"
  
  [[1]]$global_freq_ppb
  [1] 211592.6
  
  
  [[2]]
  [[2]]$global_stdev_ppb
  [1] 11561448
  
  [[2]]$range
  [1] 0.08870838
  
  [[2]]$tok
  [1] "world"
  
  [[2]]$global_freq_ppb
  [1] 1002043
  </code></pre>
  
  <p>I want to convert this list to a data frame where each index element is a column.  The natural (to me) thing to go is to is use <code>do.call</code>:</p>
  
  <pre><code>&gt; my.matrix&lt;-do.call("rbind", my.list)
  &gt; my.matrix
       global_stdev_ppb range      tok     global_freq_ppb
  [1,] 24267673         0.03114799 "hello" 211592.6       
  [2,] 11561448         0.08870838 "world" 1002043
  </code></pre>
  
  <p>Straightforward enough, but when I attempt to cast this matrix as a data frame, the columns remain list elements, rather than vectors:</p>
  
  <pre><code>&gt; my.df&lt;-as.data.frame(my.matrix, stringsAsFactors=FALSE)
  &gt; my.df[,1]
  [[1]]
  [1] 24267673
  
  [[2]]
  [1] 11561448
  </code></pre>
  
  <p>Currently, to get the data frame cast properly I am iterating over each column using <code>unlist</code> and <code>as.vector</code>, then recasting the data frame as such:</p>
  
  <pre><code>new.list&lt;-lapply(1:ncol(my.matrix), function(x) as.vector(unlist(my.matrix[,x])))
  my.df&lt;-as.data.frame(do.call(cbind, new.list), stringsAsFactors=FALSE)
  </code></pre>
  
  <p>This, however, seem very inefficient.  Is there are better way to do this?</p>