# NOT RUN {
## example: iris dataset
## load the forestRK package
library(forestRK)
## Numericize the data
x.train <- x.organizer(iris[,1:4], encoding = "num")[c(1:25,51:75,101:125),]
y.train <- y.organizer(iris[c(1:25,51:75,101:125),5])$y.new
y.factor.levels <- y.organizer(iris[c(1:25,51:75,101:125),5])$y.factor.levels
## Construct a tree
# min.num.obs.end.node.tree is set to 5 by default;
# entropy is set to TRUE by default
tree.entropy <- construct.treeRK(x.train, y.train)
# Plot the tree
draw.treeRK(tree.entropy, y.factor.levels, font="Times",
node.colour = "black", text.colour = "white", text.size = 0.7,
tree.vertex.size = 100, tree.title = "Decision Tree",
title.colour = "dark green")
# }
Run the code above in your browser using DataLab