cleancut {dvmisc} | R Documentation |
Convert Numeric to Factor with Convenient Interface
Description
So you can stop guess-and-checking with cut
.
Usage
cleancut(x, breaks, labels = NULL)
Arguments
x |
Numeric vector. |
breaks |
Character string, e.g. |
labels |
Character vector. |
Value
Factor or integer vector.
Examples
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)
[Package dvmisc version 1.1.4 Index]