title: Remove NA from list of lists
body: <p>I have a matrix, data.mat, that looks like:</p>
  
  <pre><code>A B C D E  
  45 43 45 65 23   
  12 45 56 NA NA   
  13 4  34 12 NA  
  </code></pre>
  
  <p>I am trying to turn this into a list of lists, where each row is one list within a bigger list.  I do the following:</p>
  
  <pre><code>list &lt;- tapply(data.mat,rep(1:nrow(data.mat),ncol(data.mat)),function(i)i)
  </code></pre>
  
  <p>which gives me a list of lists, with NAs included, such as:</p>
  
  <pre><code>$`1`  
   [1]  45 43 45 65 23  
  $`2`  
   [1]  12 45 56 NA NA  
  $`3`  
   [1]  13 4 34 12 NA  
  </code></pre>
  
  <p>But what I want is:</p>
  
  <pre><code>$`1`  
   [1]  45 43 45 65 23  
  $`2`  
   [1]  12 45 56   
  $`3`  
   [1]  13 4 34 12   
  </code></pre>
  
  <p>Is there a good way to remove the NAs either during the tapply call or after the fact?  </p>