R/decyear2date.R

Defines functions decyear2date

Documented in decyear2date

#' decyear2date
#'
#' @param x date
#' @author 
#' Alan Jassby, James Cloern
#' @export
decyear2date <- 
function(x) {
	yr <- floor(x)
	len <- ifelse(leapYear(yr), 366, 365)
	julday <- floor((x - yr) * len)
	as.Date(julday, origin = as.Date(paste(yr, 1, 1, sep = '-')))
}

Try the wql package in your browser

Any scripts or data that you put into this service are public.

wql documentation built on Aug. 10, 2022, 5:06 p.m.