This function takes a date
as input and returns the closest year.
Arguments
- date
A date
in the format of "YYYY-MM-DD"
.
Value
An integer
representing the closest year to the input date.
Examples
if (FALSE) {
find_closest_year(as.Date("2022-07-15"))
find_closest_year(as.Date("2022-01-01"))
}