powered by
Create a categorical hierarchy from a numeric attribute using cut points.
hierarchy_cut(attribute, breaks, labels = NULL, new_attribute = NULL)
returns an object of class hierarchy_cut
hierarchy_cut
numeric attribute to discretize
numeric breakpoints for cut
cut
optional labels for the cut intervals
name of the new attribute (default: "attribute.Level")
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)
Run the code above in your browser using DataLab