lbl_dash | R Documentation |
This label style is user-friendly, but doesn't distinguish between left- and right-closed intervals. It's good for continuous data where you don't expect points to be exactly on the breaks.
lbl_dash(
symbol = em_dash(),
fmt = NULL,
single = "{l}",
first = NULL,
last = NULL,
raw = FALSE
)
symbol |
String: symbol to use for the dash. |
fmt |
String, list or function. A format for break endpoints. |
single |
Glue string: label for singleton intervals. See |
first |
Glue string: override label for the first category. Write e.g.
|
last |
String: override label for the last category. Write e.g.
|
raw |
If you don't want unicode output, use lbl_dash("-")
.
A function that creates a vector of labels.
If fmt
is not NULL
then it is used to format the endpoints.
If fmt
is a string, then numeric endpoints will be formatted by
sprintf(fmt, breaks)
; other endpoints, e.g. Date objects, will be
formatted by format(breaks, fmt)
.
If fmt
is a list, then it will be used as arguments to format.
If fmt
is a function, it should take a vector of numbers (or other objects
that can be used as breaks) and return a character vector. It may be helpful
to use functions from the {scales}
package, e.g. scales::label_comma()
.
Other labelling functions:
lbl_discrete()
,
lbl_endpoints()
,
lbl_glue()
,
lbl_intervals()
,
lbl_manual()
,
lbl_midpoints()
,
lbl_seq()
chop(1:10, c(2, 5, 8), lbl_dash())
chop(1:10, c(2, 5, 8), lbl_dash(" to ", fmt = "%.1f"))
chop(1:10, c(2, 5, 8), lbl_dash(first = "<{r}"))
pretty <- function (x) prettyNum(x, big.mark = ",", digits = 1)
chop(runif(10) * 10000, c(3000, 7000), lbl_dash(" to ", fmt = pretty))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.