On the circular space, angles can be only in the range (-pi;pi
or -180;180). When subtracting angles, this can result in values outside of
this range. For example, when calculating the difference between a value of
10 degrees minus 340 degrees, this results in a difference of 330 degrees.
However, the true difference between these two values is -30 degrees. This
function wraps such values, so that they occur in the circle
Usage
wrap(x, radians = TRUE)
Value
An object of the same type as x
Arguments
x
A numeric vector, matrix or data.frame of angles to be wrapped. In
radians (default) or degrees.
radians
Logical. Is x in radians (default=TRUE) or degrees (FALSE)