R/leapYear.R

Defines functions leapYear

Documented in leapYear

#' leapYear
#' @description \code{TRUE} if \code{x} is a leap year, \code{FALSE}
#' otherwise.
#' @param x integer year
#' @author 
#' Alan Jassby, James Cloern
#' @export
leapYear <- 
function(x) {
  if (!is.numeric(x))
    stop('x must be numeric')
  x <- floor(x)
  x%%4 == 0 & (x%%100 != 0 | x%%400 == 0)
}

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.