title: Remove Blank Subitems of List
body: <p>Hi I am trying to remove blank sub-items of a list:</p>
  
  <pre><code>l &lt;- list(c(1:3), c(1,"",3))
  </code></pre>
  
  <p>and the output should look like</p>
  
  <pre><code>[[1]]
  [1] 1 2 3
  [[2]]
  [1] 1 3
  </code></pre>
  
  <p>I've tried the following with no success:</p>
  
  <pre><code>l[lapply(l, function(x) x != "")]
  </code></pre>
  
  <p>and the I get the error:</p>
  
  <pre><code>Error in l[lapply(l, function(x) x != "")] : 
   invalid subscript type 'list'
  </code></pre>
  
  <p>Seems simple, but I have not found the solution here on SO.</p>