hierarchy_cut: Hierarchy mapping by cut

View source: R/trans_hierarchy_cut.R

hierarchy_cutR Documentation

Hierarchy mapping by cut

Description

Create a categorical hierarchy from a numeric attribute using cut points.

Usage

hierarchy_cut(attribute, breaks, labels = NULL, new_attribute = NULL)

Arguments

attribute

numeric attribute to discretize

breaks

numeric breakpoints for cut

labels

optional labels for the cut intervals

new_attribute

name of the new attribute (default: "attribute.Level")

Value

returns an object of class hierarchy_cut

Examples

data(iris)
hc <- hierarchy_cut(
 "Sepal.Length",
 breaks = c(-Inf, 5.5, 6.5, Inf),
 labels = c("baixo", "medio", "alto")
)
iris_h <- transform(hc, iris)
table(iris_h$Sepal.Length.Level)

daltoolbox documentation built on Feb. 10, 2026, 9:06 a.m.