Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

snip.tree

Snip Parts of Tree Objects


Description

snip.tree has two related functions. If nodes is supplied, it removes those nodes and all their descendants from the tree.

If nodes is not supplied, the user is invited to select nodes interactively; this makes sense only if the tree has already been plotted. A node is selected by clicking with the left mouse button; its number and the deviance of the current tree and that which would remain if that node were removed are printed. Selecting the same node again causes it to be removed (and the lines of its sub-tree erased). Clicking any other button terminates the selection process.

Usage

snip.tree(tree, nodes, xy.save = FALSE,
          digits = getOption("digits") - 3)

Arguments

tree

An object of class "tree".

nodes

An integer vector giving those nodes that are the roots of sub-trees to be snipped off. If missing, the user is invited to select a node at which to snip.

xy.save

If true, the x and y coordinates selected interactively are saved as attribute .xy of the returned value.

digits

Precision used in printing statistics for selected nodes.

Value

A tree object containing the nodes that remain after specified or selected subtrees have been snipped off.

Note

Prior to version 1.0-34, the saved coordinates were place in object .xy in the workspace.

Author(s)

B. D. Ripley

See Also


tree

Classification and Regression Trees

v1.0-40
GPL-2 | GPL-3
Authors
Brian Ripley [aut, cre]
Initial release
2019-03-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.