title: Show columns with NAs in a data.frame
body: <p>I'd like to show the names of columns in a large dataframe that contain missing values. Basically, I want the equivalent of complete.cases(df) but for columns, not rows. Some of the columns are non-numeric, so something like</p>
  
  <pre><code>names(df[is.na(colMeans(df))])
  </code></pre>
  
  <p>returns "Error in colMeans(df) : 'x' must be numeric." So, my current solution is to transpose the dataframe and run complete.cases, but I'm guessing there's some variant of apply (or something in plyr) that's much more efficient.</p>
  
  <pre><code>nacols &lt;- function(df) {
    names(df[,!complete.cases(t(df))])
  } 
  
  w &lt;- c("hello","goodbye","stuff")
  x &lt;- c(1,2,3)
  y &lt;- c(1,NA,0)
  z &lt;- c(1,0, NA)
  tmp &lt;- data.frame(w,x,y,z)
  
  nacols(tmp)
  [1] "y" "z"
  </code></pre>
  
  <p>Can someone show me a more efficient function to identify columns that have NAs?</p>