is_leap_year: Determines if it is a leap year

Description Usage Arguments Details Examples

Description

It follows the established rules to figure out if is a leap year (https://en.wikipedia.org/wiki/Leap_year). It uses astronomial year numbering for years before the Gregorian calendar was established. (https://en.wikipedia.org/wiki/Astronomical_year_numbering)

Usage

1

Arguments

year

The year to evaluate. It expects a integer number. It also expects the astronomical number of years older than 1. For example, to evaluate year 401 BCE, use -400.

Details

The year is designated as leap if: the year number is divisible by 400, or if the year number is divisible by 4, but it is not divisible by 100.

Examples

1
2
3
4
is_leap_year(2012)
is_leap_year(-401)
# To evaluate multiple years
as.integer(lapply(2000:2005, is_leap_year))

edgararuiz/maya documentation built on June 4, 2019, 8:53 a.m.