seglength: Segment lengths of a track

Description Usage Arguments Details Value Author(s) Examples

Description

Calculates the length of each segment of a track

Usage

1
2
  ## S4 method for signature 'SpatialPointsDataFrame'
seglength(x)

Arguments

x

a Move, MoveStack or MoveBurst object

Details

The seglength function calculates the distances between point 1 and point 2, point 2 and point 3, and so on.
Distances are calculates with the pointDistance function from the package raster.

Value

A numeric vector one element shorter than the number of locations is obtained. Note that in moveStacks distances are not split between animals (see 'Examples' on how to add the values to a moveStack).

Length in map units.
If the projection of the coordinates is longitude/latitude all values are returned in meters, otherwise it is the Euclidean distance in the map units of the projection of the move object. Check and set the projection of your Move, MoveStack or MoveBurst object using the proj4string() function.

Author(s)

Marco Smolla

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
## Move object in longlat projection
data(leroy)
head(seglength(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$segLength <- c(seglength(leroy), NA)

## MoveStack object in longlat projection
data(fishers)
head(seglength(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$segLength <-  unlist(lapply(lapply(split(fishers),seglength),c, NA))

## End(Not run)

move documentation built on Nov. 17, 2017, 8:07 a.m.