daysInMonth: Days in a Month

View source: R/daysInMonth.R

daysInMonthR Documentation

Days in a Month

Description

Computes the number of days in a month or the total number of days in the year to the end of the month.

Usage

daysInMonth(month, year, cum = FALSE)

Arguments

month

the month number, must range in value from 1 to 12. Missing values are permitted.

year

the calendar year, replicated in length to match month. Missing values are permitted.

cum

a logical value. If TRUE, then return the cumulative days during the calendar year at the end of each month. If FALSE, then return the number of days in the month.

Value

A vector matching month of the requested number of days. Missing values are returned wherever either month or year is missing.

Examples

# Check February on a leap year and regular year.
# Should return 29, 28
daysInMonth(c(2,2), c(2000, 2001))

USGS-R/smwrBase documentation built on Oct. 18, 2022, 9:55 a.m.