Hi. I am trying to do a regression on some data but I only have the timepoints in date format. I would like to change them to day number but have no idea how. What seems to be complicating things is that I have separate rows for each data point. I.e. here rows 1-2 refer to the same patient (SID 28) but 3 different results. How can I change the "date" column here to day number with respect to the first row for each SID?
SID Date <chr> <chr> <dbl> <chr>
1 28 2019-09-12 00:00:00 1 NO 2.07 NO
2 28 2018-09-13 00:00:00 0 NO 2.63 NO
3 28 2022-02-24 00:00:00 0 NO 2.25 NO
4 52 2021-04-22 00:00:00 0 NO 1.38 NO
5 52 2020-10-01 00:00:00 1 NO NA NO
6 52 2019-09-26 00:00:00 1 NO 1.56 NO
7 52 2018-09-27 00:00:00 0 NO 1.65 NO
8 52 2022-05-19 00:00:00 0 Yes NA Yes
9 52 2023-01-05 00:00:00 1 NO 1.26 NO
10 88 2019-01-03 00:00:00 3 NO NA NO