TrajAngles | R Documentation |
Calculates the step angles (in radians) of each segment, either relative to the previous segment or relative to the specified compass direction.
TrajAngles(trj, lag = 1, compass.direction = NULL)
trj |
the trajectory whose angles are to be calculated. |
lag |
Angles between every lag'th segment are calculated. Only applies
to non-directed walks, i.e. |
compass.direction |
If not |
Note that since turning angles are circular quantities, i.e. 360° == 0°, it is incorrect to treat them as linear quantities. In particular, do not calculate arithmetic means or standard deviations of turning angles. See Batschelet, (1981) for a detailed explanation and techniques for dealing with circular quantities.
The turning angle before and after every zero-length segment will be
NA
, since the angle of a zero-length segment is undefined. This
behaviour began in trajr
version 1.5.0 (or development version
1.4.0.9000). Prior to this fix, the angle of a zero-length segment was
assumed to be 0, which led to incorrect turning angles being returned. One
approach to dealing with zero-length segments is to simply remove them from
the trajectory. See TrajFromTrjPoints
for a means to achieve this.
Step angles in radians, normalised so that -pi < angle <= pi
.
If compass.direction
is NULL
(the default), the returned
vector will have length nrow(trj) - 2
, i.e. one angle for every pair
of adjacent segments. If compass.direction
is not NULL
, the
returned vector will have length nrow(trj) - 1
, i.e. one angle for
every segment.
Batschelet, E. (1981). Circular statistics in biology. ACADEMIC PRESS, 111 FIFTH AVE., NEW YORK, NY 10003, 1981, 388.
TrajStepLengths
,
TrajMeanVectorOfTurningAngles
,
TrajFromTrjPoints
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.