Learn R Programming

trajr (version 1.0.0)

TrajDirectionalChange: Directional change (DC)

Description

Calculates the time variation of directional change (DC) of a trajectory sensu Kitamura & Imafuku (2015). Directional change is defined as the angular change (in degrees) between any two points in the trajectory, divided by the time difference between the two points.

Usage

TrajDirectionalChange(trj, nFrames = 1)

Arguments

trj

Track to calculate DC for.

nFrames

Frame delta to process: if 1, every frame is processed, if 2, every 2nd frame is processed, and so on. Default is 1.

Value

The directional change (DC) in degrees between every pair of consecutive points in the trajectory, i.e. the returned vector will have length (nrow(trj) - 1).

Details

This function returns the DC for each pair of consecutive points. Kitamura & Imafuku (2015) used the mean and the standard deviation of DC for portions of trajectories as index values of nonlinearity and irregularity respectively.

References

Kitamura, T., & Imafuku, M. (2015). Behavioural mimicry in flight path of Batesian intraspecific polymorphic butterfly Papilio polytes. Proceedings of the Royal Society B: Biological Sciences, 282(1809). doi:10.1098/rspb.2015.0483

Examples

Run this code
# NOT RUN {
set.seed(42)
trj <- TrajGenerate()
SD = mean(TrajDirectionalChange(trj))
SDDC = sd(TrajDirectionalChange(trj))

# }

Run the code above in your browser using DataLab