date2winter | R Documentation |
Convert a POSIXt date into categories corresponding to the time spanning from the late months of a year to the early months of the following year
date2winter(x, first = 10, last=4)
x |
a vector of POSIXt dates |
first |
number of the first month to include (default 10, October) |
last |
number of the last month to include (default 4, April) |
In ecology, time data must often be analysed on a time span category covering two successive years (e.g. the winter period). This function convert POSIXt dates into categories corresponding to the time span stretching from a user defined month of a given year (by default October) to a user-defined month of the following year (by default April). If date month is out of the user defined time span the value 'Excluded' is returned.
A vector of the same length as x, with the time span category each value belongs to.
dates <- strptime(c("02/12/2002", "15/01/2003","15/10/2003","15/6/2003",NA),"%d/%m/%Y")
date2winter(dates)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.