qtr: Assign a date to a quarter

Description Usage Arguments Details Examples

View source: R/qtr.R

Description

The qtr functions take a date input and calculate the relevant quarter-related value from it. They all return the year as part of this value.

Usage

1
2
3
4
5
6
7
qtr(date, format = c("long", "short"))

qtr_end(date, format = c("long", "short"))

qtr_next(date, format = c("long", "short"))

qtr_prev(date, format = c("long", "short"))

Arguments

date

A date supplied with Date class.

format

A character string specifying the format the quarter should be displayed in. Valid options are 'long' (January to March 2018) and 'short' (Jan-Mar 2018). The default is 'long'.

Details

Quarters are defined as:

Examples

1
2
3
4
5
6
7
8
9
x <- lubridate::dmy(c(26032012, 04052012, 23092012))

qtr(x)

qtr_end(x, format = "short")

qtr_next(x)

qtr_prev(x, format = "short")

davidc92/phsmethods2 documentation built on Jan. 23, 2020, 12:18 a.m.