Subscript a Tree Object

DESCRIPTION:

Returns a tree object containing the subtree rooted at the specified node, providing that node > 0. If node < 0, the nodes below the specified node will be removed from the tree object.

USAGE:

[.tree(x, ..., drop = T) 
x[node] 
x[-node] 

REQUIRED ARGUMENTS:

x
Tree object, as output by the functions tree, snip.tree, or select.tree. The subscript number must reference a node number in the tree object.

VALUE:

a tree object containing the subtree rooted at node (if node > 0); otherwise the tree object with nodes below node removed.

DETAILS:

This is method for the generic "[" operator. The method relies on tree-specific functions select.tree and snip.tree to do the actual work. These functions can be called directly by users for interactive use.

SEE ALSO:

, , , .

EXAMPLES:

z.auto <- tree(Mileage ~ Weight, car.test.frame) 
z.auto[7] 
# Gives the following output: 
node), split, n, deviance, yval 
      * denotes terminal node 
 7) root 22 61.320 20.41   
  14) Weight<3637.5 16 32.940 21.06   
    28) Weight<3322.5 10 16.500 20.50   
      56) Weight<3197.5 5 11.200 20.60 * 
      57) Weight>3197.5 5  5.200 20.40 * 
    29) Weight>3322.5 6  8.000 22.00 * 
  15) Weight>3637.5 6  3.333 18.67 *