seasons: Seasonal Categories

View source: R/seasons.R

seasonsR Documentation

Seasonal Categories

Description

Create categories for any definitions of seasons by month and day.

Usage

seasons(x, breaks, Names = paste("Season Ending ", breaks, sep = ""))

Arguments

x

any vector of valid dates or date-time data of class "Date" or "POSIXt."

breaks

either month names of the end of the seasons or specific days in the form of "mm/dd," where mm is the 2-digit month and dd is the 2-digit day. Breaks in the form of "mm/dd" indicate the last day of each season. Breaks must be in calendar order.

Names

optional names for the seasons.

Details

The default names for the seasons are of the form "Season Ending ...," where ... is derived from breaks.

Value

A factor of seasonal categories.

See Also

month

Examples


## Just two seasons
seasons(as.Date(c("2001-03-31", "2001-06-30", "2001-09-30")), breaks=c("June", "December"))
## The equivalent using mm/dd format
seasons(as.Date(c("2001-03-31", "2001-06-30", "2001-09-30")), breaks=c("06/30", "12/31"))
## Not run: 
# Apply to a real dataset
library(smwrData)
data(QW05078470)
transform(QW05078470, Seas=seasons(DATES, breaks=c("June", "December")))

## End(Not run)

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