title: Remove rows which have all NAs in certain columns
body: <p>Suppose you have a dataframe with 9 columns. You want to remove cases which have all NAs in columns 5:9. It's not at all relevant if there are NAs in columns 1:4.</p>
  
  <p>So far I have found functions that allow you to remove rows that have NAs in <em>any</em> of the columns 5:9, but I specifically need to remove only those that have <em>all</em> NAs in columns 5:9.</p>
  
  <p>I wrote my own function to do this, but since I have 300k+ rows, it's very slow. I was wondering is there a more efficient way? This is my code:</p>
  
  <pre><code>remove.select.na&lt;-function(x, cols){
    nrm&lt;-vector("numeric")
    for (i in 1:nrow(x)){
      if (sum(is.na(x[i,cols]))&lt;length(cols)){
        nrm&lt;-c(nrm,i)
      }
      #Console output to track the progress
      cat('\r',paste0('Checking row ',i,' of ',nrow(x),' (', format(round(i/nrow(x)*100,2), nsmall = 2),'%).'))
      flush.console()
    }
    x&lt;-x[nrm,]
    rm(nrm)
    return(x)
  }
  </code></pre>
  
  <p>where x is the dataframe and cols is a vector containing names of the columns that should be checked for NAs.</p>