Skip to contents

Convert a date into a year

Usage

as_year(x)

Arguments

x

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

Value

A character vector representing the years of the input

Examples

# Retrieve only the year
as_year("1988-01-01")
#> [1] "1988"