Detect the season from a vector of dates

detect_season(x, invert = FALSE)

Arguments

x

vector of dates in the format YYYY-MM-DD.

invert

logica, when TRUE the seasons will be inverted.

Value

a character vector containing the correspondent season. Can be spring, summer, autumn, winter.

Examples

detect_season("2040-01-31")
#> [1] "Winter"
detect_season(c("2040-01-31", "2023-04-01", "2015-09-02"))
#> [1] "Winter" "Spring" "Summer"