title: Break up rows representing long time intervals into multiple rows
body: <p>I have a dataframe (tibble) with multiple rows, each row contains an IDNR, a start date, an end date and an exposure status. The IDNR is a character variable, the start and end date are date variables and the exposure status is a numerical variable. This is what the top 3 rows look like:</p>
  
  <pre><code># A tibble: 48,266 x 4
  
     IDNR                 start      end        exposure
     &lt;chr&gt;                &lt;date&gt;     &lt;date&gt;        &lt;dbl&gt;
   1 1                    2018-02-15 2018-07-01        0
   2 2                    2017-10-30 2018-07-01        0
   3 3                    2016-02-11 2016-12-03        1
  
  # ... with 48,256 more rows
  </code></pre>
  
  <p>In order to do a time-varying cox regression, I want to split up the rows into 90 day parts, while maintaining the start and end date. Here is an example of what I would like to achieve. What happens, is that the new end date is start + 90 days, and a new row is created. This row has the start date which is the same as the end date from the previous row. If the time between start and end is now less than 90 days, this is fine (as for IDNR 1 and 3), however, for IDNR 2 the time is still exceeding 90 days. Therefore a third row needs to be added.</p>
  
  <pre><code># A tibble: 48,266 x 4
  # Groups:   IDNR [33,240]
     IDNR                 start      end        exposure
     &lt;chr&gt;                &lt;date&gt;     &lt;date&gt;        &lt;dbl&gt;
   1 1                    2018-02-15 2018-05-16        0
   2 1                    2018-05-16 2018-07-01        0
   3 2                    2017-10-30 2018-01-28        0
   4 2                    2018-01-28 2018-04-28        0
   5 2                    2018-04-28 2018-07-01        0
   6 3                    2016-02-11 2016-08-09        1
   7 3                    2016-08-09 2016-12-03        1 
  </code></pre>
  
  <p>I'm relatively new to coding in R, but I've found dplyr to be very useful so far. So, if someone knows a solution using dplyr I would really appreciate that.</p>
  
  <p>Thanks in advance!</p>