title: r dplyr group_by values collapse and paste
body: <p>I have a data set that looks like this</p>
  
  <pre><code>Id   Subject    Date        Vitals       Value
  10   John       2001-05-29  HeartRate    65
  10   John       2001-05-29  HeartRate    68
  10   John       2001-05-29  BP-Arterial  48
  10   John       2001-05-29  PulseRate    64
  34   Pete       2005-08-15  HeartRate    68
  34   Pete       2005-08-15  BP-Arterial  56
  10   John       2004-09-25  HeartRate    65
  10   John       2004-09-25  BP-Arterial  64
  10   John       2004-09-25  PulseRate    63   
  34   Pete       2007-07-21  BP-Arterial  68
  34   Pete       2007-07-21  PulseRate    56
  </code></pre>
  
  <p>I want to do two things,</p>
  
  <p>1) group by Vitals.
  2) Count the number of Vitals that were measured for each ID on a specific date <code>(ID + Date)</code> and collapse and paste these values like this below.</p>
  
  <pre><code>Vitals      Series
  HeartRate   2,1,1
  BP-Arterial 1,1,1,1
  PulseRate   1,1,1 
  </code></pre>
  
  <p>The value under the Series column for <code>HeartRate</code> is <code>2, 1, 1</code> because HeartRate was measured </p>
  
  <p>twice for ID 10 on 2001-05-29, </p>
  
  <p>once for ID 34 on 2005-08-15 and </p>
  
  <p>once for ID 10 on 2004-09-24</p>
  
  <p>Not sure how to collapse and paste these values using dplyr any help is much appreciated.</p>