title: dplyr summarise: Equivalent of ".drop=FALSE" to keep groups with zero length in output
body: <p>When using <code>summarise</code> with <code>plyr</code>'s <code>ddply</code> function, empty categories are dropped by default. You can change this behavior by adding <code>.drop = FALSE</code>. However, this doesn't work when using <code>summarise</code> with <code>dplyr</code>. Is there another way to keep empty categories in the result?</p>
  
  <p>Here's an example with fake data.</p>
  
  <pre><code>library(dplyr)
  
  df = data.frame(a=rep(1:3,4), b=rep(1:2,6))
  
  # Now add an extra level to df$b that has no corresponding value in df$a
  df$b = factor(df$b, levels=1:3)
  
  # Summarise with plyr, keeping categories with a count of zero
  plyr::ddply(df, "b", summarise, count_a=length(a), .drop=FALSE)
  
    b    count_a
  1 1    6
  2 2    6
  3 3    0
  
  # Now try it with dplyr
  df %.%
    group_by(b) %.%
    summarise(count_a=length(a), .drop=FALSE)
  
    b     count_a .drop
  1 1     6       FALSE
  2 2     6       FALSE
  </code></pre>
  
  <p>Not exactly what I was hoping for. Is there a <code>dplyr</code> method for achieving the same result as <code>.drop=FALSE</code> in <code>plyr</code>?</p>