bin.rpart: Bin numerical values based on recursive partitioning (rpart)

Description Usage Arguments Value Examples

View source: R/bin_rpart.R

Description

bin.rpart relies on rpart function to split numerical values into different nodes. According to the tree-structure splits generated form rpart, bin.rpart further divides the numerical values into different bins, and record the cut points. The usage of bin.rpart is similar to rpart, except that the argument of control in rpart is named as rcontrol in bin.rpart

Usage

1
2
bin.rpart(formula, data, rcontrol = rpart.control(), n.group = NULL,
  ...)

Arguments

formula

The formula for rpart

data

The data frame used for binning

rcontrol

The arguments passed into rpart.control

n.group

Number of acceptable binning groups. It can be NULL, a single number (e.g., 5), or a vector (e.g., 3:7). If the value is NULL, it returns the output with the default rpart.control settings. If the n.group is a numeric value, it will change the cp value within rpart.control automatically, until it gets the desirable number of groups

...

All other arguments that can be passed to rpart

Value

The cut points (cut.points) and bins.

Examples

1
2
data <- rpart::stagec
bin.rpart(pgstat ~ age, data = data)

JianhuaHuang/streamlineR documentation built on Aug. 19, 2018, 6:59 a.m.