title: Pivot_wider: Combine Duplicate Observations AND Create New Variable Columns for Those Values
body: <p>I'm new to R and have scoured the site to find a solution - I've found lots of similar, but slightly different questions. I'm stumped.</p>
  <p>I have a dataset in this structure:</p>
  <pre><code>  SURVEY_ID    CHILD_NAME    CHILD_AGE
    Survey1      Billy             4
    Survey2      Claude            12
    Survey2      Maude             6
    Survey2      Constance         3
    Survey3      George            22
    Survey4      Marjoram          14
    Survey4      LeBron            37
  </code></pre>
  <p>I'm trying to pivot the data wider so that there's a) only one unique SURVEY_ID per row, and, critically, b) a new column for second, third, etc. children for surveys with more than one child.</p>
  <p>So the result would look like:</p>
  <pre><code>    SURVEY_ID    CHILD_NAME1    CHILD_NAME2    CHILD_NAME3    CHILD_AGE1  CHILD_AGE2  CHILD_AGE3
      Survey1      Billy                                        4
      Survey2      Claude         Maude          Constance      12          6           3
      Survey3      George                                       22
      Survey4      Marjoram       Lebron                        14          37
  </code></pre>
  <p>The actual data has thousands of surveys and the number of &quot;child names&quot; and &quot;child ages&quot; could be as high as 10. It's the issue of creating the new columns not from existing value names and only where there are multiple children that has me perplexed.</p>