title: How do I remove empty data frames from a list?
body: <p>I've got dozens of lists, each is a collection of 11 data frames. Some data frames are empty (another script did not output any data, not a bug).</p>
  
  <p>I need to push each list through a function but that chokes when it sees an empty data frame.  So how do I write a function that will take a list, do a dim on each element (i.e. data frame) and if it's 0, then skip to the next.</p>
  
  <p>I tried something like this:</p>
  
  <pre><code>empties &lt;- function (mlist)
  {
   for(i in 1:length(mlist))
     {
      if(dim(mlist[[i]])[1]!=0) return (mlist[[i]])
      }
  }
  </code></pre>
  
  <p>But clearly, that didn't work. I would do this manually at this point but that would take forever. Help?</p>