Learn R Programming

data.tree (version 0.2.0-3)

Clone: Clone a tree (creates a deep copy)

Description

The method also clones object attributes (such as the formatters).

Usage

Clone(node, pruneFun = NULL, attributes = FALSE)

Arguments

node

the root node of the tree or sub-tree to clone

pruneFun

a function taking a Node as an argument, and returning TRUE if the Node and its descendants should be kept, FALSE otherwise.

attributes

if FALSE, then attributes are not cloned. This makes the method much faster.

Value

the clone of the tree

See Also

SetFormat

Examples

Run this code
# NOT RUN {
data(acme)
acmeClone <- Clone(acme)
acmeClone$name <- "New Acme"
# acmeClone does not point to the same reference object anymore:
acme$name
# }

Run the code above in your browser using DataLab