cleancut: Convert Numeric to Factor with Convenient Interface

Description Usage Arguments Value Examples

View source: R/cleancut.R

Description

So you can stop guess-and-checking with cut.

Usage

1
cleancut(x, breaks, labels = NULL)

Arguments

x

Numeric vector.

breaks

Character string, e.g. "[-Inf, 0), [0, 10], (10, Inf)".

labels

Character vector.

Value

Factor or integer vector.

Examples

1
2
3
4
5
6
x <- rnorm(100)
y <- cleancut(x, "(-Inf, -1), [-1, 1], (1, Inf)")
tapply(x, y, range)

y <- cleancut(x, "(-Inf, -1), [-1, 1], (1, Inf)", c("<-1", "-1 to 1", ">1"))
tapply(x, y, range)

dvmisc documentation built on Dec. 18, 2019, 1:35 a.m.