Rules {ModTools} | R Documentation |
Extract Rules from 'rpart' Object
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
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
Examples
r.rp <- FitMod(diabetes ~ ., data=d.pima, fitfn="rpart")
Rules(r.rp)
[Package ModTools version 0.9.6 Index]