vector_angle: Compute the angle of a vector

View source: R/main.R

vector_angleR Documentation

Compute the angle of a vector

Description

Compute the angle of a vector

Usage

vector_angle(x, origin = c(0, 0), degrees = FALSE, allow_negative = FALSE)

Arguments

x

A length-2 vector

origin

A length-2 vector

degrees

If TRUE, returns angles in degrees instead of radians

allow_negative

If TRUE, returns angles between -pi and pi (-180 and +180. If FALSE, returns angles between 0 and 2 * pi (0 and 360)

Value

A length-1 vector

Examples

vector_angle(c(1,1))
vector_angle(c(1,1), degrees = TRUE)

wjschne/WJSmisc documentation built on June 29, 2023, 8:04 a.m.