I have a dataframe of ids and timestamps. I\'d like to calculate the difference between each sequential timestamp for an individual id.
My dataframe looks like this:
Like this:
dat %>% group_by(id) %>% mutate(time.difference = time - lag(time))