View source: R/trans_hierarchy_cut.R
| hierarchy_cut | R Documentation |
Create a categorical hierarchy from a numeric attribute using cut points.
hierarchy_cut(attribute, breaks, labels = NULL, new_attribute = NULL)
attribute |
numeric attribute to discretize |
breaks |
numeric breakpoints for |
labels |
optional labels for the cut intervals |
new_attribute |
name of the new attribute (default: "attribute.Level") |
returns an object of class hierarchy_cut
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.