seasonYear: Season of Year

View source: R/seasonYear.R

seasonYearR Documentation

Season of Year

Description

Create an ordered factor or numeric values from a vector of dates based on the season of the year.

Usage

seasonYear(x, start.month = "June", end.month = "September",
  numeric = FALSE)

seasonYearMD(x, start.day = "06/01", end.day = "09/30", numeric = FALSE)

Arguments

x

an object of class "Date" or "POSIXt." Missing values are permitted and result in corresponding missing values in the output.

start.month

a charcter string indicating the starting month of the season, must match either the month name (month.name) or the month abbreviation (month.abb). See Details.

end.month

a charcter string indicating the ending month of the season, must match either the month name (month.name) or the month abbreviation (month.abb). See Details.

numeric

a logical value that indicates whether the returned values should be numeric TRUE or an ordered factor FALSE. The default value is FALSE.

start.day

a character string of the form "mm/dd" indicating the starting day of the season.x

end.day

a character string of the form "mm/dd" indicating the last day of the season. Use "02/29" for the last day in February.

Details

The season year is allowed to overlap the calendar year, so the end.month may precede the start.month.

Value

An ordered factor or numeric vector corresponding to the season of the year. Input data values outside of the months specified are retruned as missing values NA.

Note

For seasonYear, the season year is defined as the period from the first day of the starting month to the last day of the ending month. For seasonYearMD, it is the specified month and day for the beginning and ending of the period. The season year is designated by the calendar year in which it ends. Thus, the season year starting December 1, 1998 and ending March 30, 1999, is the "1999 December-March season year."

See Also

month.name, month.abb

Examples


## Not run: 
library(smwrData)
data(QW05078470)
## Return an ordered factor
seasonYear(QW05078470$DATES)
## Should be the same
seasonYearMD(QW05078470$DATES)

## End(Not run)

USGS-R/DVstats documentation built on Oct. 11, 2022, 6:03 a.m.