Print an en-dash

en(from = "", to = "", format = NA, expand = F)

Arguments

from

Character. If the en-dash separates two strings, the first one.

to

Character. If the en-dash separates two strings, the second one.

format

Function. If provided, formats from and to.

expand

Logical. Add spaces?

Value

Character. The from and to strings, separated by an en-dash (UTF-8).

en is a wrapper for glue, so you can use curly bracket notation in from and to, just like with glue.

Examples

library(lubridate)
#> #> Attaching package: 'lubridate'
#> The following object is masked from 'package:base': #> #> date
library(scales) en()
#> –
en(today(), today() %m+% months(1))
#> 2019-09-30–2019-10-30
en(today(), today() %m+% months(1), format = date_format("%B %e, %Y"))
#> September 30, 2019–October 30, 2019
en(1234, 5678)
#> 1234–5678
en(1234, 5678, format = comma)
#> 1,234–5,678
en(1234, 5678, format = comma, expand = TRUE)
#> 1,234 – 5,678