calendar_leap_year {clock} | R Documentation |
calendar_leap_year()
detects if the year is a leap year according to
the Gregorian calendar. It is only relevant for calendar types that use
a Gregorian year, i.e. year_month_day()
, year_month_weekday()
, and
year_day()
.
calendar_leap_year(x)
x |
A calendar type to detect leap years in. |
A logical vector the same size as x
. Returns TRUE
if in a leap
year, FALSE
if not in a leap year, and NA
if x
is NA
.
x <- year_month_day(c(2019:2024, NA))
calendar_leap_year(x)