lbl_intervals {santoku}R Documentation

Label chopped intervals using set notation

Description

These labels are the most exact, since they show you whether intervals are "closed" or "open", i.e. whether they include their endpoints.

Usage

lbl_intervals(
  fmt = NULL,
  single = "{{{l}}}",
  first = NULL,
  last = NULL,
  raw = FALSE
)

Arguments

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

Mathematical set notation looks like this:

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_dash(), lbl_discrete(), lbl_endpoints(), lbl_glue(), lbl_manual(), lbl_midpoints(), lbl_seq()

Examples


tab(-10:10, c(-3, 0, 0, 3),
      labels = lbl_intervals())

tab(-10:10, c(-3, 0, 0, 3),
      labels = lbl_intervals(fmt = list(nsmall = 1)))

tab_evenly(runif(20), 10,
      labels = lbl_intervals(fmt = percent))


[Package santoku version 0.10.0 Index]