last.node.of.subtree: Internal Function that finds the Last Node of Subtrees

Description Usage Arguments Details Value Author(s) Examples

Description

Returns the node number of the last node of a rooted subtree.

Usage

1
2
3
last.node.of.subtree(
	tree, 
	subtree.root.name)

Arguments

tree

An object of class tree.

subtree.root.name

The name of the root of the subtree.

Details

Knowing the node numbers of both the root node (of a subtree) and the last node of such a subtree is sufficient to isolate all nodes from this rooted subtree (as node are numbered in a recursive manner, left first then right).

Value

The node number of the last node of a rooted subtree.

Author(s)

A. Truong

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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)

oblique.tree documentation built on April 15, 2017, 4:38 a.m.