as_year function

Convert a date into a year

Convert a date into a year

as_year(x)

Arguments

  • x: an object coercible into a base::Date . See base::as.Date().

Returns

A character vector representing the years of the input

Examples

# Retrieve only the year as_year("1988-01-01")