Calculates the time lags between consecutive locations of a track.

# S4 method for .MoveTrackSingle
timeLag(x,...)
  # S4 method for .MoveTrackStack
timeLag(x,units, ...)

Arguments

x

a move, moveStack or moveBurst object

units

The units used for the conversion (e.g. "secs", "mins", "hours", "days" or "weeks"). They should be specified for a moveStack to ensure the same units between individuals. Optional (but recommended).

...

Currently not implemented.

Details

Optionally the argument units can be passed on to ensure the time lag is in a certain unit, this is especially useful in case of a moveStack. For more information on the units argument see the help of difftime.

Value

Time lags in the specified units.

If a move or moveBurst object is provided, a numeric vector one element shorter than the number of locations is obtained.
If a moveStack object is provided, a list with one element per individual containing a numeric vector one element shorter than the number of locations is obtained.

Author

Bart Kranstauber & Anne Scharf

Examples

## time lags from a Move object data(leroy) head(timeLag(leroy, units="hours"))
#> [1] 0.2480556 0.2363883 0.2408344 0.2508331 0.2483333 0.2566664
# to add this information to the move object, a "NA" has to be assigened # e.g. to the first location (it also could be assigend to the first location). leroy$timeLag <- c(timeLag(leroy, units="hours"), NA) ## time lags from a MoveStack object data(fishers) str(timeLag(fishers, units="mins"))
#> List of 2 #> $ Leroy : num [1:918] 14.9 14.2 14.5 15 14.9 ... #> $ Ricky.T: num [1:999] 27.55 2.55 1.883 2.217 0.583 ...
# to add this information to the moveStack object, a "NA" has to be assigened # e.g. to the duration is assigned to the first location of each segment fishers$timeLag <- unlist(lapply(timeLag(fishers, units="mins"), c, NA))