A simple data type for storing year-quarter dates in a human readable integer format, e.g.: 3.Quarter of 2012 is stored as 20123. Supports simple arithmetic operations such as + and - as well formatting.

date_yq(y, q)

is_date_yq(x)

as_date_yq(x)

Arguments

y

year

q

quarter (optional)

x

any R object

Value

date_yq returns an object of type date_yq

is_date_yq returns TRUE or FALSE depending on whether its argument is of type date_yq or not.

as_date_yq attempts to coerce its argument to date_yq

See also

Examples

date_yq(2013, 3)
#> [1] "2013-Q3"
as_date_yq(20161)
#> [1] "2016-Q1"