Skip to contents

Computes the sample mean direction. For axial data, angles are doubled before computing the mean and the result is transformed back to the axial scale.

Usage

mean_direction(x, axial = FALSE, na.rm = TRUE)

Arguments

x

Numeric vector of angles in radians.

axial

Should the data be treated as axial, modulo pi?

na.rm

Should missing values be removed?

Value

A single angle in radians, or NA_real_ when the mean is undefined.

Examples

mean_direction(c(0, pi / 4, pi / 2))
#> [1] 0.7853982