track_param: Calculate parameters between locations

track_paramR Documentation

Calculate parameters between locations

Description

Calculate time, distance, speed, and inner angle between successive locations

Usage

track_param(
  sdata,
  param = c("time", "distance", "speed", "angle", "mean speed", "mean angle"),
  days = 2
)

Arguments

sdata

A data.frame or a list of data.frames containing columns with the following headers: "id", "DateTime", "lat", "lon". The function calculates each movement parameter by a unique "id" (e.g. transmitter number, identifier for each animal) if the input is a data.frame, or by each element of the list if the input is a list. "DateTime" is the GMT date & time of each location in class POSIXct or character with the following format "2012-06-03 01:33:46". "lat" and "lon" are the latitude and longitude of each location in decimal degrees.

param

A string or vector specifying movement parameters to be calculated. Options are 'time', 'distance', 'speed', 'angle', 'mean speed' and 'mean angle'. See details.

days

A numeric value specifying the number of days to calculate mean speeds and angles. This argument is only used when 'mean speed' and/or 'mean angle' are selected in param.

Details

This function calculates various parameters of tracks. time (h), distance (km), speed (km/h) and inner angle (degrees) are calculated from each pair of successive locations. mean speed (km/h) and angle (degrees) are calculated from locations over a specified number of days.

Value

The input data is returned with new columns containing the requested parameters. "pTime" and "sTime" are hours from a previous and to a subsequent fix respectively. "pDist" and "sDist" are straight distances in kilometres from a previous and to a subsequent fix respectively. "pSpeed" and "sSpeed" are linear speed (km/h) from a previous and to a subsequent fix respectively. "inAng" is the degree between the bearings of lines joining successive location points. "meanSpeed" and "meanAngle" are the mean speed and degree over a specified number of days.

Author(s)

Takahiro Shimada

Examples

#### Load turtle tracking data
data(turtle)


#### Filter temporal and/or spatial duplicates
turtle.dup <- dupfilter(turtle, step.time=5/60, step.dist=0.001)


#### ddfilter
turtle.dd <- ddfilter(turtle.dup, vmax=9.9, qi=4, ia=90, vmaxlp=2.0)


#### Mean speed over 2 days
mean.speed <- track_param(turtle.dd, param = c('speed', 'mean speed'), days=2)


#### Plot data
ggplot(data = mean.speed, aes(x=lon, y=lat)) +
geom_path(colour = 'grey') +
geom_point(aes(colour=meanSpeed))

SDLfilter documentation built on Nov. 10, 2023, 1:11 a.m.