t2rad: Transform dates to radians

Description Usage Arguments Details Value Author(s) References Examples

View source: R/t2rad.R

Description

Transform dates to radians.

Usage

1
t2rad(t, dpc)

Arguments

t

A vector of numeric dates to be transformed to polar coordinates.

dpc

A numeric value representing the number of divisions per cycle (e.g., hours per day, days per year, etc.)

Details

t2rad transforms the sequence t of dates to radians using:

(t - 1) % d / d * 2π

where d indicates the number of days per year in sequence t.

Value

Returns a vector of polar coordinates the same length as input vector t.

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
dpy <- 365                 # Days/year
data(mndvi)                # Load data
t <- as.vector(mndvi$day)  # Days since January 1, 2000
r <- t2rad(t, dpc=dpy)     # Transform days of year to radians
head(cbind(t,r))           # Compare results

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