Tests whether a date or year is a leap year.
This returns NA if the corresponding datey would be invalid, including
years before 1000 and dates after 3000-01-01.0.
For numerics, this returns NA for years values less than 1000 or greater
than 3000.
This is an S3 generic. This package provides methods for:
numeric types
doubleandinteger(interpreted as calendar years, e.g.2000.9means the calendar year 2000), anddate types
datey,Date,POSIXctandPOSIXlt.
Usage
is_leap_year(x)
# Default S3 method
is_leap_year(x)
# S3 method for class 'integer'
is_leap_year(x)
# S3 method for class 'double'
is_leap_year(x)
# S3 method for class 'datey'
is_leap_year(x)
# S3 method for class 'Date'
is_leap_year(x)
# S3 method for class 'POSIXct'
is_leap_year(x)
# S3 method for class 'POSIXlt'
is_leap_year(x)Value
NA if x is not interpretable as a year or date, or outside [1000,3000],
TRUE if x is a leap year, otherwise
FALSE.