title: Adding rows in `dplyr` output
body: <p>In traditional <code>plyr</code>, returned rows are added automagically to the output even if they exceed the number of input rows for that grouping:</p>
  
  <pre><code>set.seed(1)
  dat &lt;- data.frame(x=runif(10),g=rep(letters[1:5],each=2))
  &gt; ddply( dat, .(g), function(df) df[c(1,1,1,2),] )
              x g
  1  0.26550866 a
  2  0.26550866 a
  3  0.26550866 a
  4  0.37212390 a
  5  0.57285336 b
  6  0.57285336 b
  7  0.57285336 b
  8  0.90820779 b
  9  0.20168193 c
  10 0.20168193 c
  11 0.20168193 c
  12 0.89838968 c
  13 0.94467527 d
  14 0.94467527 d
  15 0.94467527 d
  16 0.66079779 d
  17 0.62911404 e
  18 0.62911404 e
  19 0.62911404 e
  20 0.06178627 e
  </code></pre>
  
  <p>I cannot figure out how to do the same in <code>dplyr</code>.  Some attempts:</p>
  
  <pre><code>dat %&gt;% group_by(g) %&gt;% summarise( xbar = mean(x) )
  
  &gt; dat %&gt;% group_by(g) %&gt;% summarise( xbar = runif(3) )
  Error: expecting a single value
  
  # Getting creative...
  
  &gt; dat %&gt;% group_by(g) %&gt;% function(x) x[c(1,1,1,2),]
  
  # Nope.
  </code></pre>
  
  <p>How do I do this?</p>
  
  <p>The specific use case I'm butting up against is splitting a <code>\n</code>-delimited text field and making it "long," but I use this feature of <code>ddply</code> all the time for many purposes.</p>