View source: R/smwrBase_baseDay.R
baseDay | R Documentation |
Computes the base day of the year, a reference value that can be used to group days for the computation of summary statistics. From smwrBase package.
baseDay(x, numeric = TRUE, year = c("calendar", "water", "climate"))
x |
a vector of class POSIXt, Dates, or character that represents a date. Missing values are permitted. |
numeric |
a logical value; |
year |
a character string indicating the basis of the factor levels. See Details. |
The base day is computed such that all dates have the same reference value
regardless of whether the year is a leap year or not. If year
is
"calendar," then the factor levels or day number begin on January 1; if year
is
"water," then the factor levels or day number begin on October 1; and if year
is
"climate," then the factor levels or day number begin on April 1.
An integer value representing the base day number if numeric
is TRUE
. Otherwise a factor with levels for every day of the year.
# The default numeric result
baseDay(c("2000-02-29", "2000-03-01", "2001-03-01"))
# The result as a factor
baseDay(c("2000-02-29", "2000-03-01", "2001-03-01"), numeric=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.