Coerce and Format to Year-Quarter Strings
format_yq(x, q = NULL, format = "%Y-Q%q")
x, q | Two integer (vectors).
|
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
format | A format that uses a subset of the same placeholders as
Not all placeholders are supported for all |
a character
vector
Format shorthand functions in the form of format_y*_[preset]()
directly
apply formatting presets to anything that can be coerced to a date_xx
.
This is notably handy as they can be used as a labeling function for
ggplot2 axes (see vignette("dint")
)
format_yq(2015, 1)#> [1] "2015-Q1"format_yq(20151, format = "short")#> [1] "short"format_yq(20151, format = "shorter")#> [1] "shorter"