Learn R Programming

simplevis (version 5.0.0)

interval_labels: Convert numeric or interval cuts to simple and pretty labels.

Description

Convert numeric or interval cuts to simple and pretty labels.

Usage

interval_labels(cuts, digits = NULL, right_closed = TRUE)

Arguments

cuts

A vector or numeric or character interval cuts.

digits

If cuts are numeric, the number of decimal places to round labels to.

right_closed

If cuts are numeric, TRUE or FALSE of whether intervals are to be right-closed. Defaults to TRUE.

Value

A vector of character labels.

Examples

Run this code
# NOT RUN {
library(simplevis)

interval_labels(c(0, 0.1, 3, 4.1, 7, 100, Inf))

interval_labels(c("(0, 10]", "(10, 50]", "(50, 100]"))

interval_labels(c("[0, 10)", "[10, 50)", "[50, 100)"))

# }

Run the code above in your browser using DataLab