R/date2decyear.R

Defines functions date2decyear

Documented in date2decyear

#' date2decyear
#' @param w date
#' @author 
#' Alan Jassby, James Cloern
#' @export
date2decyear <- 
function(w) {
  old_ops <- options(digits = 8)
  on.exit(options(old_ops))
  posx <- as.POSIXlt(w)
  yr <- 1900 + posx$year
  dy <- posx$yday + 0.5
  yr + dy/ifelse(leapYear(yr), 366, 365)
}

Try the wql package in your browser

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

wql documentation built on May 29, 2024, 6:32 a.m.