Get First or Last Day of Quarter From Year and Quarter

first_of_yq(x, q = NULL)

last_of_yq(x, q = NULL)

Arguments

x

Two integer (vectors). q is optional and the interpretation of x will depend on whether q is supplied or not:

  • if only x is supplied, x will be passed to as_date_yq() (e.g. x = 20161 means first quarter of 2016)

  • if x and q are supplied, x is interpreted as year and q as quarter.

q

Two integer (vectors). q is optional and the interpretation of x will depend on whether q is supplied or not:

  • if only x is supplied, x will be passed to as_date_yq() (e.g. x = 20161 means first quarter of 2016)

  • if x and q are supplied, x is interpreted as year and q as quarter.

Value

a Date

See also

Examples

first_of_yq(2016, 1)
#> [1] "2016-01-01"
first_of_yq(20161)
#> [1] "2016-01-01"