title: Summary stats for missing values split by class
body: <p>Here is my data frame:</p>
  
  <pre><code>x1 &lt;- as.numeric(c(1.5, 3.2, 5.1, 6.6, NA))
  x2 &lt;- as.numeric(c(3.4, 5.6, NA, NA, 0.9))
  x3 &lt;- as.character(c("abc", NA, "cde", NA, NA))
  x4 &lt;- as.logical(c(1, 1, 0, 1, 0))
  x5 &lt;- as.integer(c(NA, 2, 4, 7, 9))
  
  df &lt;- data.frame(x1, x2, x3, x4, x5, stringsAsFactors = F)
  </code></pre>
  
  <p>Summary stats for missing values (percentages):</p>
  
  <pre><code>summary( round(apply(is.na(df), 2, sum)/(nrow(df)), 4) )
  </code></pre>
  
  <p>I could extract the columns by class and apply the summary stats 4 times to get these for the unique classes:</p>
  
  <pre><code>unique(sapply(df, class))
  </code></pre>
  
  <p>I was wondering if there is a nice way with fewer lines of code to put the summary stats in one table split by class?</p>
  
  <p>I appreciate your help.</p>
  
  <p>Thank you very much </p>
  
  <p>Rami</p>