Learn R Programming

RbcBook1 (version 1.40.0)

rpart2gNEL: rpart to graphNEL Converter

Description

Creates an object of class graphNEL from one of class rpart.

Usage

rpart2gNEL(tr, remap=function(x) x, nsep="\n")

Arguments

tr
instance of rpart class from rpart package.
remap
function that maps node names in tree to node names in graph.
nsep
token that separates node name and vote tally in the rendering.

Value

a graphNEL-class instance with nodes constructed to convey information on the data tree fit

Details

Not explicitly used in the book, but the basis for a certain graph illustrating application of rpart. The newer coin/party packages have more interesting rendering approaches based on graphviz.

grabSplitV is a utility function for acquiring the variable names, remapAff will remap affymetrix probe names to gene symbols for use in the remap parameter.

See Also

rpart, graphNEL-class

Examples

Run this code
library(rpart)
example(rpart)
ff = rpart2gNEL(fit2)
ff
nodes(ff)

Run the code above in your browser using DataLab