get_quarter: Returns the quarter (and its bounding dates) for a given date

Description Usage Arguments Value Examples

Description

This function returns the quarter name, start date, and end date for a given date. Optionally, the function can return the information for past and present quarters.

Usage

1

Arguments

Date

the input date

offset

the number of quarters ahead or behind to look

Value

A single-row data.frame with four variables:

qtr.num

The quarter as a numeric, 1 through 4

qtr

A more complete label in the format "2013 Q3"

start.date

The first day of the quarter

end.date

The last day of the quarter

Examples

1
2
3
4
5
6
7
8
# The current quarter's information
get_quarter(Sys.Date())

# Information about the next quarter
get_quarter(Sys.Date(), 1)

# Information about the last quarter
get_quarter(Sys.Date(), -1)

mmparker/mpmisc documentation built on May 23, 2019, 5:05 a.m.