discretize_transform: Transform a data.frame using split points returned by...

View source: R/discretize_transform.R

discretize_transformR Documentation

Transform a data.frame using split points returned by discretize function.

Description

Transform a data.frame using split points returned by discretize function.

Usage

discretize_transform(disc, data, dropColumns = NA)

extract_discretize_transformer(disc)

Arguments

disc

a result of the discretize function.

data

a data.frame to transform using cutpoints from disc.

dropColumns

determine

Value

A new data.frame with discretized columns using cutpoints from the result of discretize function.

Examples


set.seed(123)
idx <- sort(sample.int(150, 100))
iris1 <- iris[idx, ]
iris2 <- iris[-idx, ]
disc <- discretize(Species ~ ., iris)
head(discretize_transform(disc, iris2))

# Chain discretization:
ir1 <- discretize(Species ~ Sepal.Length, iris1)
ir2 <- discretize(Species ~ Sepal.Width, ir1, control = equalsizeControl(3))
ir3 <- discretize(Species ~ Petal.Length, ir2, control = equalsizeControl(5))

## note that Petal.Width is untouched:
head(discretize_transform(ir3, iris2))

## extract_discretize_transformer
discObj <- extract_discretize_transformer(ir3)
head(discretize_transform(discObj, iris2))


FSelectorRcpp documentation built on Oct. 3, 2024, 1:08 a.m.