redhatqtr_dates: Get a start and end dates for Red Hat quarters

Description Usage Arguments Details Value Examples

View source: R/quarters.R

Description

Get a data frame of start dates and end dates for previous quarters, or the start and end dates for the current or provided Red Hat quarter.

Usage

1
redhatqtr_dates(x = Sys.Date(), n = 4, current = FALSE)

Arguments

x

The date-type value to determine quarters. Either a date, yearmon, date-type string like '2016-04-25', year like '2017', an old-style qtr year like 'Q1FY18' or a new-style year qtr like 'FY18Q1'

n

An integer. How many previous quarters?

current

A logical scalar. Do you want just the current start and end?

Details

The function can take muliple date types (see examples), and produces a data frame with the previous four quarters. It can provide as many quarters as needed. It can also just provide a vector of the start date and end date of the current quarter.

Value

Returns a data frame with start date, end date, new quarter format, and old quarter format. If current = TRUE, then returns a vector of start and end dates

Examples

1
2
3
4
5
6
7
8
9
redhatqtr_dates()
redhatqtr_dates("2016-04-25")
redhatqtr_dates(as.Date("2016-04-12"))
redhatqtr_dates(zoo::as.yearmon("2016-04-05"))
redhatqtr_dates(n = 8)
redhatqtr_dates('2017', n = 12)
redhatqtr_dates('Q1FY18')
redhatqtr_dates('FY18Q1')
redhatqtr_dates('FY18Q1', current = TRUE)

brascoball/hattyr documentation built on Sept. 16, 2017, 4:29 a.m.