Skip to contents

Converts angles to the nearest label among labels. Angles are interpreted as bearings by default: zero is north and angles increase clockwise.

Usage

rad_to_compass(x, labels = c("N", "NE", "E", "SE", "S", "SW", "W", "NW"))

Arguments

x

Numeric vector of angles in radians.

labels

Character vector of equally spaced labels.

Value

Character vector of labels.

Examples

rad_to_compass(c(0, pi / 2, pi))
#> [1] "N" "E" "S"