plot.DecisionTreeObject: plotDecisionTree

Description Usage Arguments Examples

View source: R/plot.DecisionTreeObject.R

Description

plot a decision tree

Usage

1
2
3
## S3 method for class 'DecisionTreeObject'
plot(DecisionTreeObject, dict, green = 1,
  left = 1)

Arguments

DecisionTreeObject

object of class DecisionTreeObject generated by function decisionTree

dict

a data.frame of optional names for nodes, colnames of data.frame are: vName and toPlot, remember about stringsAsFactors=F

green

which class should be coloured in green? 0 or 1?

left

which class should be mentioned on leaves

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
d <- iris[, c("Species", "Sepal.Length", "Sepal.Width")]
d$Species <- as.character(d$Species)
d$Species[d$Species != "setosa"] <- "non-setosa"
x <- d$Sepal.Length
x[d$Sepal.Length <= 5.2] <- "Very Short"
x[d$Sepal.Length >  5.2 & d$Sepal.Length <= 6.1] <- "Short"
x[d$Sepal.Length >  6.1 & d$Sepal.Length <= 7.0] <- "Long"
x[d$Sepal.Length >  7.0] <- "Very Long"
d$Sepal.Length <- x
decTree <- decisionTree(d, eta=5, purity=0.95, minsplit=0)
plot(decTree)

tomis9/decisionTree documentation built on May 29, 2019, 9:55 a.m.