#grow a tree on the Pima Indian dataset
data(Pima.tr, package = "MASS")
ob.tree <- oblique.tree(formula = type~.,
data = Pima.tr,
oblique.splits = "on")
plot(ob.tree);text(ob.tree);title(main="Oblique Tree")
#what is the node number of the last node of the entire tree?
oblique.tree:::last.node.of.subtree(
tree = ob.tree,
subtree.root.name = 1)
#what is the node number of the last node of the subtree rooted at the node with name '4'?
oblique.tree:::last.node.of.subtree(
tree = ob.tree,
subtree.root.name = 4)
Run the code above in your browser using DataLab