Skip to contents

Cut date-time vectors into seasons

Usage

cut_season(x, labels = NULL)

Arguments

x

a date-time vector

labels

a list for recoding. Names and order should be "DJF", "MAM", "JJA", "SON"

Value

factor of seasons

Examples

dates <- lubridate::ymd(010101) + months(0:11)

cut_season(dates)
#>  [1] DJF DJF MAM MAM MAM JJA JJA JJA SON SON SON DJF
#> Levels: DJF < MAM < JJA < SON

cut_season(dates, c(DJF = "winter", MAM = "spring", JJA = "summer", SON = "autumn"))
#>  [1] winter winter spring spring spring summer summer summer autumn autumn
#> [11] autumn winter
#> Levels: winter < spring < summer < autumn