title: Create combinations by group and sum
body: <p>I have data of names within an ID number along with a number of associated values. It looks something like this:</p>
  <pre><code>structure(list(id = c(&quot;a&quot;, &quot;a&quot;, &quot;b&quot;, &quot;b&quot;), name = c(&quot;bob&quot;, &quot;jane&quot;, 
  &quot;mark&quot;, &quot;brittney&quot;), number = c(1L, 2L, 1L, 2L), value = c(1L, 
  2L, 1L, 2L)), class = &quot;data.frame&quot;, row.names = c(NA, -4L))
  
  #   id     name number value
  # 1  a      bob      1     1
  # 2  a     jane      2     2
  # 3  b     mark      1     1
  # 4  b brittney      2     2
  </code></pre>
  <p>I would like to create all the combinations of <code>name</code>, regardless of how many there are, and paste them together separated with commas, and sum their <code>number</code> and <code>value</code> within each <code>id</code>. The desired output from the example above is then:</p>
  <pre><code>structure(list(id = c(&quot;a&quot;, &quot;a&quot;, &quot;a&quot;, &quot;b&quot;, &quot;b&quot;, &quot;b&quot;), name = c(&quot;bob&quot;, 
  &quot;jane&quot;, &quot;bob, jane&quot;, &quot;mark&quot;, &quot;brittney&quot;, &quot;mark, brittney&quot;), number = c(1L, 
  2L, 3L, 1L, 2L, 3L), value = c(1L, 2L, 3L, 1L, 2L, 3L)), class = &quot;data.frame&quot;, row.names = c(NA, -6L))
  
  #   id           name number value
  # 1  a            bob      1     1
  # 2  a           jane      2     2
  # 3  a      bob, jane      3     3
  # 4  b           mark      1     1
  # 5  b       brittney      2     2
  # 6  b mark, brittney      3     3
  </code></pre>
  <p>Thanks all!</p>