get_season: Get the season of a date-time

View source: R/seasons.R

get_seasonR Documentation

Get the season of a date-time

Description

Gets the metereological season of a date or date-time object. Days in December belong to the summer of the next year. For example December 24, 2010 belongs to summer 2011.

Usage

get_season(x, with_year = TRUE)

Arguments

x

a date-time object of class POSIXct, POSIXlt, Date, chron, yearmon, yearqtr, zoo, zooreg, timeDate, xts, its, ti, jul, timeSeries, fts or anything else that can be converted with as.POSIXlt

with_year

logical indicating whether or not to include the season's year/

Value

a string with the season or the year and the season

Examples

 x <- lubridate::ymd("2010-01-15") + seq(0, 365*2, length.out = 25)
 get_season(x, with_year = TRUE)
 get_season(x, with_year = FALSE)

StatisticsNZ/er.helpers documentation built on Oct. 2, 2023, 7:24 a.m.