R/years.R

Defines functions years

Documented in years

#' Years
#'
#' Extract year from Date/POSIXt object.
#'
#' @param x a vector of dates, of class \code{Date} or \code{POSIXt}.
#'
#' @return Vector of years as integers.
#'
#' @export

years <- function(x)
{
  as.integer(format(x, "%Y"))
}
arni-magnusson/arni documentation built on Nov. 3, 2023, 7:35 p.m.