R/zzz.R

Defines functions numeric_year is.nanull

# invisible functions to the general user
# used internally only load in start

is.nanull <- function(x) ifelse(any(is.null(x), is.na(x)), TRUE, FALSE)

numeric_year <- function(x){
  y <- as.numeric(format(x, format="%Y"))
  doy <- as.numeric(format(x, format="%j")) - 1

 ifelse(y %% 4 == 0, 
    round(y + doy/366, 3), 
    round(y + doy/365, 3)
    )
}

Try the rsofun package in your browser

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

rsofun documentation built on Nov. 2, 2023, 6:02 p.m.