Learn R Programming

rbooster (version 1.1.0)

discretize: Discretize

Description

Discretizes numeric variables

Usage

discretize(xx, breaks = 3, boundaries = NULL, categories = NULL, w = NULL)

Arguments

xx

matrix or data.frame whose variables needs to be discretized.

breaks

number of categories for each variable. Ignored if boundaries != NULL.

boundaries

user-defined upper and lower limit matrix of discretization for each variable. Default is NULL.

categories

user-defined category names for each variable. Default is NULL.

w

sample weights for quantile calculation.

Value

a list consists of:

x_discrete

data.frame of discretized variables. Each variable is a factor.

boundaries

upper and lower limit matrix of discretization for each variable.

categories

category names for each variable.

Details

Uses quantiles for discretization. However, quantiles may be equal in some cases. Then equal interval discretization used instead.