title: Merging of 2 rows if the date is the same or +- 7 days, and the ID is the same
body: <p>So i've been trying to get my head around this but i can't figure out how to do it.</p>
  
  <p>This is an example:</p>
  
  <pre><code>ID  Hosp. date  Discharge date
  1   2006-02-02  2006-02-04
  1   2006-02-04  2006-02-18
  1   2006-02-22  2006-03-24
  1   2008-08-09  2008-09-14
  2   2004-01-03  2004-01-08
  2   2004-01-13  2004-01-15
  2   2004-06-08  2004-06-28
  </code></pre>
  
  <p>What i want is a way to combine rows by ID, IF the discarge date is the same as the Hosp. date (or +-7 days) in the next row. So it would look like this:</p>
  
  <pre><code>ID  Hosp. date  Discharge date
  1   2006-02-02  2006-03-24
  1   2008-08-09  2008-09-14
  2   2004-01-03  2004-01-15
  2   2004-06-08  2004-06-28
  </code></pre>