title: Elegant way to report missing values in a data.frame
body: <p>Here's a little piece of code I wrote to report variables with missing values from a data frame.  I'm trying to think of a more elegant way to do this, one that perhaps returns a data.frame, but I'm stuck:</p>
  
  <pre><code>for (Var in names(airquality)) {
      missing &lt;- sum(is.na(airquality[,Var]))
      if (missing &gt; 0) {
          print(c(Var,missing))
      }
  }
  </code></pre>
  
  <p>Edit: I'm dealing with data.frames with dozens to hundreds of variables, so it's key that we only report variables with missing values.</p>