formatBreaks: Helper for more readable labels when use with 'cut'

View source: R/formatBreaks.R

formatBreaksR Documentation

Helper for more readable labels when use with cut

Description

Helper for more readable labels when use with cut

Usage

formatBreaks(
  brks,
  inbetween_sep = "-",
  prefix_first = "< ",
  prefix_last = "> ",
  suffix_first = "",
  suffix_last = ""
)

Arguments

brks

numeric vector that will be used to cut

inbetween_sep, prefix_first, prefix_last, suffix_first, suffix_last

strings that are put in between intervals, at the beginning or at the intervals only.

Value

a character string

Examples

cont_var <- rnorm (100) * 100
brks <- pretty(cont_var, n = 10) # or range(cont_var) %>% pretty()
brks_labels <- formatBreaks(brks, inbetween_sep = ' - ')
formatBreaks(brks, inbetween_sep = ' - ', suffix_first = " unité")
cut(cont_var, breaks = brks, labels = brks_labels)

d-qn/tamTheme documentation built on Feb. 8, 2023, 10:46 a.m.