lbl_dash {santoku}R Documentation

Label chopped intervals like 1-4, 4-5, ...

Description

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.

Usage

lbl_dash(
  symbol = em_dash(),
  fmt = NULL,
  single = "{l}",
  first = NULL,
  last = NULL,
  raw = FALSE
)

Arguments

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 lbl_glue() for details.

first

Glue string: override label for the first category. Write e.g. first = "<{r}" to create a label like "<18". See lbl_glue() for details.

last

String: override label for the last category. Write e.g. last = ">{l}" to create a label like ">65". See lbl_glue() for details.

raw

[Deprecated]. Use the raw argument to chop() instead.

Details

If you don't want unicode output, use lbl_dash("-").

Value

A function that creates a vector of labels.

Formatting endpoints

If fmt is not NULL then it is used to format the endpoints.

See Also

Other labelling functions: lbl_discrete(), lbl_endpoints(), lbl_glue(), lbl_intervals(), lbl_manual(), lbl_midpoints(), lbl_seq()

Examples

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))

[Package santoku version 0.10.0 Index]