Learn R Programming

mappings (version 0.1)

cut_mapping: 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

Run this code
# NOT RUN {
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))
# }

Run the code above in your browser using DataLab