The given dataset contains a timestamp in the third column which consists of a date in mm/dd/yyyy format with time in 24 hr format for the month of January. I wish to find the difference in minutes using R by comparing every row with its previous row only if patient has a common value i.e. difference of every timestamp row with previous row if patient value of both is same say "1","2" and "3". This also means that first row of the dataset should give value 0 minutes as there is nothing to compare. Thanks and please help.
patient handling time
1 Registration 1/2/2017 11:41
1 Triage and Assessment 1/2/2017 12:40
1 Registration 1/2/2017 12:40
1 Triage and Assessment 1/2/2017 22:32
1 Blood test 1/5/2017 8:59
1 Blood test 1/5/2017 14:34
1 MRI SCAN 1/5/2017 21:37
2 X-Ray 1/7/2017 4:31
2 X-Ray 1/7/2017 7:57
2 Discuss Results 1/7/2017 14:45
2 Discuss Results 1/7/2017 17:55
2 Check-out 1/9/2017 17:09
2 Check-out 1/9/2017 19:14
3 Registration 1/4/2017 1:34
3 Registration 1/4/2017 6:36
3 Triage and Assessment 1/4/2017 17:49
3 Triage and Assessment 1/5/2017 8:59
3 Blood test 1/5/2017 21:37
3 Blood test 1/6/2017 3:53