Converts dates to the corresponding numeric years

years(y)

Arguments

y

A vector of class "Date" or "POSIX" date-time.

Examples


y <- Sys.time()
years(y)
#> [1] 2026