year function

Extract the year from a date

Extract the year from a date

This function is provided primarily to be used together with dbplyr when querying a database. It will also work in dplyr against data frames.

year(date)

Arguments

  • date: The date.

Returns

The year

Examples

year(as.Date("2000-02-01"))