cut_mapping: Mapping from continuous to categorical

View source: R/mapping.R

cut_mappingR 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))

benjaminrich/mappings documentation built on June 23, 2024, 1:23 a.m.