season: Get season

Description Usage Arguments Value Examples

Description

Returns the season of the year for a date-time object.

Usage

1
season(x, label = TRUE, shoulder = FALSE)

Arguments

x

A date-time object.

label

Logical. If TRUE, will display the season as a string (e.g. "Summer"). If False, the season will be returned as a numeric value.

shoulder

Logical. If TRUE only Summer and Winter are returned with the shoulder months included in each. So summer will include October, November, December, January, February, March and Winter will include April, May, June, July, August, September. Note that if this is set to true only a label version of the season will be returned.

Value

The seasons of the year as a numeric value (1-4) or as an ordered factor ("Summer", "Autumn", "Winter", "Spring").

Examples

1
2
3
4
5
6
7
8
9
require(lubridate)
x <- dmy("12/1/2010")
season(x, label = FALSE)
# 1

x <- dmy_hm(c("1/5/2015 12:00", "1/7/2015 15:00", "1/11/2016 2:00"))
season(x)
# Autumn Winter Spring
# Levels: Summer < Autumn < Winter < Spring

camroach87/myhelpr documentation built on May 13, 2019, 11:03 a.m.