interval_labels: Convenience functions for interval recodes

Description Usage Arguments Value Examples

View source: R/recode_helpers.R

Description

Get interval labels for even intervals of discrete numeric values compatible with base::cut.

Usage

1
interval_labels(from, to, width = 5)

Arguments

from, to

A numeric value for the beginning and the end of the interval.

width

The width of the interval, e.g. 5 (default) for intervals 0-5.

Value

A character vector of interval labels compatible with base::cut.

Examples

1
2
3
4
5
6
7
## Not run: 
x <- round(runif(100, 0, 100), 0)
labels <- interval_labels(0, 100, 10)

cut(x, breaks = seq(0, 100, 10), labels = labels)

## End(Not run)

tadaatoolbox documentation built on July 2, 2020, 2:30 a.m.