I have some hospital data that looks like this:
patient_id | treatment_1 | treatment_2 | date_dummy |
---|---|---|---|
3 | 2012-01-04 | 2012-03-27 | 0 |
3 | 2021-07-11 | 2012-10-20 | 0 |
3 | 2013-04-04 | 2013-06-22 | 0 |
12 | 2012-12-09 | 2013-11-09 | 0 |
18 | 2012-02-25 | 2012-03-26 | 0 |
25 | 2012-10-06 | 2013-12-29 | 1 |
25 | 2013-04-06 | 2013-07-07 | 0 |
I need to re-create the date_dummy
variable that equals 1 if the patient was treated again between the two treatment dates, and 0 otherwise. Patient 25 is the best example of this.
If anyone knows a command to do this using the dplyr package in R that would awesome. Thanks for any help.