seasons | R Documentation |
Create categories for any definitions of seasons by month and day.
seasons(x, breaks, Names = paste("Season Ending ", breaks, sep = ""))
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. |
The default names for the seasons are of the form "Season Ending ...," where
... is derived from breaks
.
A factor of seasonal categories.
month
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.