calendar_leap_year {clock}R Documentation

Is the calendar year a leap year?

Description

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().

Usage

calendar_leap_year(x)

Arguments

x

⁠[calendar]⁠

A calendar type to detect leap years in.

Value

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.

Examples

x <- year_month_day(c(2019:2024, NA))
calendar_leap_year(x)

[Package clock version 0.6.0 Index]