rip_year() extracts the year from a date or datetime object.
rip_year(x)
| x |
The vector to extract the year from. |
|---|
An integer vector the same size as x containing the years.
#> [1] 2019# Identical dates, but in different years a <- as.POSIXct("1969-12-31 19:00:00", tz = "America/New_York") b <- as.POSIXct("1970-01-01 00:00:00", tz = "UTC") identical(as.numeric(a), as.numeric(b))#> [1] TRUErip_year(a)#> [1] 1969rip_year(b)#> [1] 1970