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.
snip.tree(tree, nodes)
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.
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]
.
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.
z.survey <- tree(market.survey, na.action = na.exclude) # 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