Coerce and Format to Year-Month Strings
format_ym(x, m = NULL, format = "%Y-M%m")
x, m | 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_ym(2015, 5)#> [1] "2015-M05"format_ym(201505, format = "short")#> [1] "short"format_ym(201505, format = "shorter")#> [1] "shorter"