title: Delete columns/rows with more than x% missing
body: <p>I want to delete all columns or rows with more than 50% <code>NA</code>s in a data frame.</p>
  
  <p>This is my solution:</p>
  
  <pre><code># delete columns with more than 50% missings
  miss &lt;- c()
  for(i in 1:ncol(data)) {
    if(length(which(is.na(data[,i]))) &gt; 0.5*nrow(data)) miss &lt;- append(miss,i) 
  }
  data2 &lt;- data[,-miss]
  
  
  # delete rows with more than 50% percent missing
  miss2 &lt;- c()
  for(i in 1:nrow(data)) {
    if(length(which(is.na(data[i,]))) &gt; 0.5*ncol(data)) miss2 &lt;- append(miss2,i) 
  }
  data &lt;- data[-miss,]
  </code></pre>
  
  <p>but I'm looking for a nicer/faster solution.</p>
  
  <p>I would also appreciate a <code>dplyr</code> solution</p>