avgAngle: Average Angle

View source: R/avgAngle.R

avgAngleR Documentation

Average Angle

Description

Calculate average angle.

Usage

avgAngle(h, w = 1, digits = getOption("digits"))

Arguments

h

a vector of angles, between 0 and 1 (0 is up and 0.25 is right).

w

a vector of weights (arbitrary scale).

digits

passed to round, to make sure that avgAngle(c(0,0.5)) returns NA.

Value

Average angle as a number.

Note

There are several ways to define average angle; this one uses the average of Cartesian coordinates.

Possible applications: current or tow direction, time of year, time of day, color hue.

Examples

# Average of NNW and NNE is north
avgAngle(c(0.875, 0.125))


arnima-github/arni documentation built on Oct. 28, 2023, 6:18 p.m.