format_date_xx {dint} | R Documentation |
Format a date_xx
Description
Format a date_xx
Usage
## S3 method for class 'date_y'
format(x, format = "%Y", ...)
## S3 method for class 'date_yq'
format(
x,
format = "%Y-Q%q",
month_names = format(ISOdate(2000, 1:12, 1), "%B"),
month_abb = format(ISOdate(2000, 1:12, 1), "%b"),
...
)
## S3 method for class 'date_ym'
format(
x,
format = "%Y-M%m",
month_names = format(ISOdate(2000, 1:12, 1), "%B"),
month_abb = format(ISOdate(2000, 1:12, 1), "%b"),
...
)
## S3 method for class 'date_yw'
format(x, format = "%Y-W%V", ...)
format_yq_iso(x)
format_yq_short(x)
format_yq_shorter(x)
format_ym_iso(x)
format_ym_short(x)
format_ym_shorter(x)
format_yw_iso(x)
format_yw_short(x)
format_yw_shorter(x)
Arguments
x |
any R object. | ||||||||||||
format |
A format that uses a subset of the same placeholders as
Not all placeholders are supported for all | ||||||||||||
... |
ignored | ||||||||||||
month_names , month_abb |
a |
Value
a character
vector
Formatting shorthands
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")
)
Examples
x <- date_ym(2018, c(1L, 10L, 3L, 6L, 4L, 5L, 7L, 12L, 2L, 9L, 8L, 11L))
fm <- "%Y-M%m: %B,%b"
format(
x,
format = fm,
month_names = month.name, # built-in R constant for English names
month_abb = month.abb
)
[Package dint version 2.1.4 Index]