Using tidyverse I have the following data:
ID timestamp
001 2021-06-04 09:45:25
001 2021-06-04 09:46:25
001 2021-06-04 09:46:35
002 2021-06-04 05:45:25
002 2021-06-04 09:45:25
004 2021-06-04 09:15:12
003 2021-06-04 09:45:25
004 2021-06-06 09:45:25
004 2021-06-04 09:45:25
And Basically I want to show the time difference between an ID's first timestamp and last in whatever format makes sense.
So the end result should look like this, x's being the difference in time fromt the MIN(TIMESTAMP and MAX(TIMESTAMP) from a given ID:
ID time_diff
001 xxxx
002 xxxx
003 NA
004 xxxx