Rules: Extract Rules from 'rpart' Object

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/CART.r

Description

Extract rules from an rpart object. This can be useful, if the rules must be implemented in another system. The rules contain all the criteria for the binary splits of an rpart tree from the root node down to the specified leaf.

Usage

1
Rules(x, node = NULL, leafonly = FALSE)

Arguments

x

the rpart object to extract the rules from

node

integer vector, defining the nodes whose details are required.

leafonly

boolean, defining if only the rules leading to end nodes ("leafs") should be returned.

Details

The function builds upon the original function path.rpart, which is bulky in some situations.

Value

a list with the rules

frame

the frame of the rpart

ylevels

the y values of the node

ds.size

the size of the dataset

path

a list of character vecotrs containing the rules

Author(s)

Andri Signorell <andri@signorell.net>

See Also

rpart, path.rpart

Examples

1
2
r.rp <- FitMod(diabetes ~ ., data=d.pima, fitfn="rpart")
Rules(r.rp)

ModTools documentation built on July 26, 2021, 9:06 a.m.