GroupYear: Extract 4-digit Year Based on Starting Month.

Description Usage Arguments Value Methods (by class) Note Examples

View source: R/date_time.R

Description

GroupYear groups a year according to a starting month. This function is useful for grouping values in year x & year x + 1 crossing over calendar year (e.g., months Oct-Sep).

Usage

1
2
3
4
5
6
7
GroupYear(x, ...)

## S3 method for class 'Date'
GroupYear(x, ..., startMon)

## S3 method for class 'data.frame'
GroupYear(x, year, mon, ..., startMon, direction = c("forward", "backward"))

Arguments

x

Object of class 'Date' or 'data.frame'.

...

Currently not used.

startMon

Integer scalar value between 1 and 12.

year

Field name in 'x' when 'x' is 'data.frame' containing numeric 4-digit year.

mon

Field name in 'x' when 'x' is 'data.frame' containing numeric 1- to 2-digit month (i.e., 1-12).

direction

Character of either "forward" or "backward" denoting whether year is moved forward (default; '+') or backward ('-').

Value

Numeric 4-digit year based on starting month.

Methods (by class)

Note

GroupYear not yet equipped to control 'end' month, so result is full 12 months based on starting month.

Examples

1
# coming soon

jasondubois/sportfish documentation built on July 3, 2020, 1:01 p.m.