title: Cumulatively paste (concatenate) values grouped by another variable
body: <p>I have a problem dealing with a data frame in R. I would like to paste the contents of cells in different rows together based on the values of the cells in another column. My problem is that I want the output to be progressively (cumulatively) printed. The output vector must be of the same length as the input vector.
  Here is a sampel table similar to the one I am dealing with:</p>
  
  <pre><code>id &lt;- c("a", "a", "a", "b", "b", "b")
  content &lt;- c("A", "B", "A", "B", "C", "B")
  (testdf &lt;- data.frame(id, content, stringsAsFactors=FALSE))
  #  id content
  #1  a       A
  #2  a       B
  #3  a       A
  #4  b       B
  #5  b       C
  #6  b       B
  </code></pre>
  
  <p>And this is want I want the result to look like:</p>
  
  <pre><code>result &lt;- c("A", "A B", "A B A", "B", "B C", "B C B") 
  result
  
  #[1] "A"     "A B"   "A B A" "B"     "B C"   "B C B"
  </code></pre>
  
  <p>What I do NOT need something like this:</p>
  
  <pre><code>ddply(testdf, .(id), summarize, content_concatenated = paste(content, collapse = " "))
  
  #  id content_concatenated
  #1  a                A B A
  #2  b                B C B
  </code></pre>