rad2d: Transform from radians to time units

Description Usage Arguments Details Value Author(s) References Examples

View source: R/rad2d.R

Description

Transform radians to dates in time units (e.g., day of year).

Usage

1
rad2d(r, dpc)

Arguments

r

A vector of numeric values of angles in radians (representing times/dates) to be converted back to time units.

dpc

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

Details

rad2d transforms input values of r from radians to dates in the interval [0,dpc+1).

Value

Returns a vector of cyclic dates in the interval [0,dpc+1) having the same length as input vector r.

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
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
days_from_rads <- rad2d(r, dpc=dpy) # Transform radians back to days of yr
head(cbind(t, days_from_rads)) # Compare results. Cols should be equiv.

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