I am trying to find sequences in a list of dates and convert them to a start and an end date.
An example of my data looks as follows:
id date
1 1 2020-01-01
2 1 2020-01-02
3 1 2020-01-03
4 1 2020-01-06
5 1 2020-01-07
6 2 2020-01-02
7 2 2020-01-03
8 2 2020-01-04
9 2 2020-01-05
10 3 2020-01-04
11 3 2020-01-07
What I would like to create is the following table:
id start date end date
1 1 2020-01-01 2020-01-03
2 1 2020-01-06 2020-01-07
3 2 2020-01-02 2020-01-05
4 3 2020-01-04 2020-01-04
5 3 2020-01-07 2020-01-07
I have been fiddling around with the diff function but I can't quite get it to work the way I want.