Learn R Programming

oeli (version 0.5.2)

find_closest_year: Find the closest year to a given date

Description

This function takes a date as input and returns the closest year.

Usage

find_closest_year(date)

Value

An integer, the closest year to the input date.

Arguments

date

A date in the format of "YYYY-MM-DD".

Examples

Run this code
find_closest_year(as.Date("2022-07-15"))
find_closest_year(as.Date("2022-01-01"))

Run the code above in your browser using DataLab