vec_ang: Calculate radial angles from horizontal and vertical...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/vec_ang.R

Description

Calculate the radial angle for each horizontal and vertical component vector pair.

Usage

1
vec_ang(vx, vy)

Arguments

vx

A numeric vector of 1 or more values representing horizontal components of Euclidean vectors. vx can be obtained using vec.x.

vy

A numeric vector of 1 or more values representing vertical components of Euclidean vectors. vy can be obtained using vec.y.

Details

vec_ang returns the angle corresponding to the horizontal (vx) and vertical vector components (vy) according to:

atan2(vy, vx) + π

Value

Returns the polar coordinate angle corresponding to each horizontal and vertical component vector pair.

Author(s)

Bjorn J. Brooks, Danny C. Lee, William W. Hargrove, Lars Y. Pomara

References

Brooks, B.J., Lee, D.C., Desai, A.R., Pomara, L.Y., Hargrove, W.W. (2017). Quantifying seasonal patterns in disparate environmental variables using the PolarMetrics R package.

Examples

1
2
3
4
5
6
7
8
dpy <- 365                 # Days/yr
data(mndvi)                # Load data
t <- as.vector(mndvi$day)  # Days since January 1, 2000
r <- t2rad(t,dpy)          # Transform days of year to radians
v <- as.vector(mndvi$wc)   # MODIS NDVI for Willow Creek tower, WI
vx <- mean(vec.x(r,v), na.rm=TRUE) # Avg horizontal vector
vy <- mean(vec.y(r,v), na.rm=TRUE) # Avg vertical vector
rv_ang <- vec_ang(vx,vy)    # Angle of resultant vec (point of max activity)

bjornbrooks/PolarMetrics documentation built on Dec. 22, 2020, 1:42 a.m.