Skip to contents

Computes the signed difference x - y on a periodic scale. With the default period, values are returned in [-pi, pi).

Usage

angular_difference(x, y, period = 2 * pi)

Arguments

x, y

Numeric vectors of angles.

period

Positive numeric period.

Value

A numeric vector following R recycling rules.

Examples

angular_difference(0, 3 * pi / 2)
#> [1] 1.570796