Calculate time duration based on sequential difference of date-time input. The unit of time duration is seconds.
date-time in POSIXct
By convention the first value is set to
NA missing value, because the
difference applies to each sequential pair of locations.
To use this on multiple track ids, use a grouped data frame with tidyverse
data %>% group_by(id) %>% mutate(duration = track_time(date))
numeric vector of duration between sequential date-time values in seconds, see Details
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.