cut_mapping {mappings}R Documentation

Mapping from continuous to categorical

Description

Mapping from continuous to categorical

Usage

cut_mapping(..., to = NULL, na = NA, ch.as.fact = TRUE)

Arguments

...

Passed to cut().

to

Passed to mapping().

na

Passed to mapping().

ch.as.fact

Passed to mapping().

Value

A function that cuts a numeric vector and maps the result.

Examples

x <- c(0, 10, 20, 30, Inf)
m <- cut_mapping(x, right=FALSE,
    to=c("0 to <10", "10 to <20", "20 to <30", ">= 30"))
print(m)
m(c(5, 27, 3, 10, 99))

[Package mappings version 0.1 Index]