Skip to contents

Returns the number of days in each of a vector of years or months.

Usage

days_in_year(year)

days_in_month(year, month)

Arguments

year

An integer vector. The years of interest.

month

An integer vector. A subset of 1:12.The months of interest.

Value

A numeric vector of the numbers of days in each of the years in year or the months specified by year and month.

Details

The length of the output vector is equal to the length of month. The argument year is recycled to the length of the output vector if necessary.

Examples

days_in_year(1999:2025)
#>  [1] 365 366 365 365 365 366 365 365 365 366 365 365 365 366 365 365 365 366 365
#> [20] 365 365 366 365 365 365 366 365

days_in_month(2024, 1:12)
#>  [1] 31 29 31 30 31 30 31 31 30 31 30 31
days_in_month(2025, 1:12)
#>  [1] 31 28 31 30 31 30 31 31 30 31 30 31
days_in_month(2024:2025, 1:3)
#> [1] 31 29 31 31 28 31