prettyTree: Visual representation of a tree-based model

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

View source: R/trees.R

Description

This function plots a tree-based model, i.e. a rpart object

Usage

1
2
3
prettyTree(t, compress = F, branch = 0.2, margin = 0.1, uniform = T,
           all = T, cex = 0.8, font = 10, use.n = T, fwidth = 0.5,
           fheight = 0.45, center = 0, ...)

Arguments

t

A rpart object

compress

A boolean parameter passed to plot.rpart(). See the help page of this function for further details. Defaults to F.

branch

A numeric parameter passed to plot.rpart(). See the help page of this function for further details. Defaults to 0.2.

margin

A numeric parameter passed to plot.rpart(). See the help page of this function for further details. Defaults to 0.1.

uniform

A boolean parameter passed to plot.rpart(). See the help page of this function for further details. Defaults to T.

all

A boolean parameter passed to text.rpart(). See the help page of this function for further details. Defaults to T.

cex

A number controling the character size. Defaults to 0.8.

font

A number setting the base font size in points. Defaults to 10.

use.n

A boolean parameter passed to text.rpart(). See the help page of this function for further details. Defaults to T.

fwidth

A numeric parameter passed to text.rpart(). See the help page of this function for further details. Defaults to 0.5.

fheight

A numeric parameter passed to text.rpart(). See the help page of this function for further details. Defaults to 0.45.

center

A numeric parameter controlling drawing of ellipses. Defaults to 0.

...

Further parameters passed both to plot.rpart() and text.rpart()

Details

This function achieves the same functionallity as applying the function plot() and then the function text() to a rpart object: it essentially obtains a graphical representation of a tree-based model. The basic differences are related to visual formatting of the trees.

Author(s)

Luis Torgo ltorgo@dcc.fc.up.pt

References

Therneau, T. M. and Atkinson, B.; port by Brian Ripley. (2010). rpart: Recursive Partitioning. R package version 3.1-46.

Torgo, L. (2010) Data Mining using R: learning with case studies, CRC Press (ISBN: 9781439810187).

http://www.dcc.fc.up.pt/~ltorgo/DataMiningWithR

See Also

plot.rpart, text.rpart, rpartXse, rpart

Examples

1
2
3
4
5
6
7
data(iris)
tree <- rpartXse(Species ~ ., iris)
## Not run: 
prettyTree(tree)
prettyTree(tree,all=F,use.n=F,branch=0)

## End(Not run)

Example output

Loading required package: lattice
Loading required package: grid

DMwR documentation built on May 1, 2019, 9:17 p.m.