I\'m trying to calculate the time difference between two timestamps in two adjacent rows using the dplyr package. Here\'s the code:
tidy_ex <- function ()
Alternatively, you can simply try:
... %>% mutate(diff = c(0,diff(timestamp)))
Or, if you want to explicitly assign the unit and convert the column to numeric for other calculations:
... %>% mutate(diff = c(0,as.numeric(diff(timestamp), units="mins")))