Learn R Programming

data.tree (version 1.1.0)

as.Node.rpart: Convert an rpart object to a data.tree structure

Description

Convert an rpart object to a data.tree structure

Usage

# S3 method for rpart
as.Node(x, digits = getOption("digits") - 3, use.n = FALSE, ...)

Value

a data.tree object. The tree contains a field rpart.id which references back to the original node id in the row names of the rpart object.

Arguments

x

the rpart object to be converted

digits

the number of digits to be used for numeric values in labels

use.n

logical. Add cases to labels, see text.rpart for further information

...

any other argument to be passed to generic sub implementations

See Also

Other as.Node: as.Node.data.frame(), as.Node.dendrogram(), as.Node.list(), as.Node.phylo(), as.Node()

Examples

Run this code
if (require(rpart)) {
   fit <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis)
   as.Node(fit)
}

Run the code above in your browser using DataLab