Learn R Programming

move (version 3.2.2)

speed: Speed between the locations of a movement track

Description

This function returns the speed between consecutive locations of Move or MoveStack object.

Usage

# S4 method for .MoveTrackSingle
speed(x)
  # S4 method for .MoveTrackStack
speed(x)

Arguments

x

a move, moveStack or moveBurst object

Value

Speed in map units/second. If the projection of the coordinates is long/lat all values are returned in m/s, otherwise in the map units/second of the projection of the move object. Check and set the projection of your Move, MoveStack or MoveBurst object using the proj4string() function.

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.

Examples

Run this code
# NOT RUN {
# speeds from a Move object 
data(leroy)
head(speed(leroy))
# to add this information to the move object, a "NA" has to be assigened
#  e.g. to the last location (it also could be assigend to the first location).
leroy$speed <- c(speed(leroy), NA)

## speeds from a MoveStack object
data(fishers)
str(speed(fishers))
# to add this information to the moveStack object, a "NA" has to be assigened
# e.g. to the last location of each individual (the speed belongs to the following segment).
fishers$speed <- unlist(lapply(speed(fishers),c, NA ))
# }

Run the code above in your browser using DataLab