Snip Subtrees of a Tree Object

DESCRIPTION:
Creates a "snipped" tree object, containing the nodes that remain after snipping off selected subtrees. Nodes can be snipped using the node argument, or interactively by clicking the mouse button on specified nodes within the graphics window.

USAGE:
snip.tree(tree, nodes)

REQUIRED ARGUMENTS:
tree:
fitted model object of class tree. This is assumed to be the result of some function that produces an object with the same named components as that returned by the tree function.

OPTIONAL ARGUMENTS:
nodes:
an integer vector containing indices (node numbers) of all subtrees to be snipped off. If missing, user selects branches to snip off as described below.

VALUE:
a tree object containing the nodes that remain after specified or selected subtrees have been snipped off. For noninteractive use, snip.tree(obj, nodes) is longhand for the left-square-bracket method for trees obj[- nodes].

GRAPHICAL INTERACTION:
A dendrogram of tree is shown on the graphics device, and a graphics input device (e.g., a mouse) is required. Clicking on a node (generally the left mouse button is the selection button) displays the total tree deviance and what the total tree deviance would be if the subtree rooted at the node were removed. Clicking a second time on the same node snips that subtree off and visually erases the subtree. This process may be repeated any number of times. Warnings result from selecting the root or leaf nodes.

Clicking the exit button (generally the right mouse button) stops the snipping process and returns the resulting tree object.

See the documentation for the specific graphics device for details on graphical input techniques.


SEE ALSO:
select.tree , Subscript.tree .

EXAMPLES:
z.survey <- tree(market.survey, na.action = na.omit) # grow the tree
plot(z.survey)  # plot the tree
snip.tree(z.survey)  # interactively select node using mouse in
                     # graphics window

z.survey[-3] # remove the subtree of z.survey rooted at node 3