Skip to contents

normalize_angle() maps numeric angles to [origin, origin + period). The default period is 2 * pi, which is appropriate for directional circular data measured in radians.

Usage

normalize_angle(x, period = 2 * pi, origin = 0)

Arguments

x

Numeric vector of angles.

period

Positive numeric period. Use 2 * pi for directional data and pi for axial data.

origin

Lower bound of the target interval.

Value

A numeric vector with the same length as x.

Examples

normalize_angle(c(-pi, 0, 3 * pi))
#> [1] 3.141593 0.000000 3.141593