time2spanTxt | R Documentation |
When adding a time span text we often don't want to write 3 jun - 10 jun but shorten it to 3 - 10 jun while retaining month and year info only if the span crosses between months or years.
time2spanTxt(
times,
day_month_glue_txt = getOption("Gmisc_time2spanTxt_day_month", default =
"{mday(time)} {month(time, label = TRUE)}"),
full_year_format = getOption("Gmisc_time2spanTxt_full_year", default =
"{mday(time)} {month(time, label = TRUE)} {year(time)}"),
start_stop_glue_txt = getOption("Gmisc_time2spanTxt_template", default =
"{start} to {stop}")
)
times |
The dates or POSIX timestamps to used for time span |
day_month_glue_txt |
The |
full_year_format |
The |
start_stop_glue_txt |
The string used in the |
There are options that can be set using the options
:
Gmisc_time2spanTxt_day_month
The date with day + month as formatted by glue
where the time is passed as time
.
Gmisc_time2spanTxt_full_year
The full date with day + month + year as formatted by glue
where the time is passed as time
.
Gmisc_time2spanTxt_template
The merge of the stop & start elements using glue
.
string
A string describing the time span
time2spanTxt(as.POSIXct(c("2020-01-02", "2020-03-01", NA)))
# 2 jan to 1 mar
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.