Calculates the distance between the consecutive locations of a Move or MoveStack object.
1 2 3 4
pointDistance is used to calculate the distances.
Distance in map units.
If the projection of the coordinates is long/lat all values are returned in meters, otherwise in the map units of the projection of the move object. For long/lat distance is calculated on a sphere using the ellipsoid, for other projections the calculation is done on a plane using Pythagoras. Check and set the projection of your Move, MoveStack or MoveBurst object using the
moveBurst object is provided, a numeric vector one element shorter than the number of locations is obtained.
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
Marco Smolla & Anne Scharf
1 2 3 4 5 6 7 8 9 10 11 12 13
## distance from a Move object data(leroy) head(distance(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$distance <- c(distance(leroy), NA) ## distance from a MoveStack object data(fishers) str(distance(fishers)) # to add this information to the moveStack object, a "NA" has to be assigened # e.g. to the last location of each individual (it also could be assigend to the first location). fishers$distance <-unlist(lapply(distance(fishers), c, NA))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.