Learn R Programming

hydroTSM (version 0.2-0)

time2season: Time character -> Seasonal character

Description

This function transforms a character vector of dates into a character vector of seasons (summer, winter, autumn, spring), considering that: -) winter = DJF: December, January, February -) spring = MAM: March, April, May -) summer = JJA: June, July, August -) autumn = SON: September, October, November

Usage

time2season(x, out.fmt = "months")

Arguments

x
vector with the dates that have to be transformed. class(x) must be Date
out.fmt
character, indicating the format of the output seasons. Possible values are: -) seasons => "winter", "spring", "summer", autumn" -) months => "DJF", "MAM", "JJA", SON"

Value

  • character vector with the weather season to which each date in x belongs

See Also

dip

Examples

Run this code
## Sequence of daily dates between "1961-01-01" and "1961-12-31"
t <- dip("1961-01-01", "1961-12-31")
time2season(t)

## Sequence of monthly dates between "1961-01-01" and "1961-12-31"
t <- mip("1961-01-01", "1961-12-31")
time2season(t)
time2season(t, out.fmt="seasons")

Run the code above in your browser using DataLab