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

LeafLabelInterchange

Leaf label interchange


Description

LeafLabelInterchange() exchanges the position of leaves within a tree.

Usage

LeafLabelInterchange(tree, n = 2L)

Arguments

tree

A tree of class phylo.

n

Integer specifying number of leaves whose positions should be exchanged.

Details

Modifies a tree by switching the positions of n leaves. To avoid later swaps undoing earlier exchanges, all n leaves are guaranteed to change position. Note, however, that no attempt is made to avoid swapping equivalent leaves, for example, a pair that are each others' closest relatives. As such, the relationships within a tree are not guaranteed to be changed.

Value

LeafLabelInterchange() returns a tree of class phylo on which the position of n leaves have been exchanged. The tree's internal topology will not change.

Author(s)

Martin R. Smith (martin.smith@durham.ac.uk)

See Also

Examples

tree <- PectinateTree(8)
plot(LeafLabelInterchange(tree, 3L))

TreeTools

Create, Modify and Analyse Phylogenetic Trees

v1.4.4
GPL (>= 3)
Authors
Martin R. Smith [aut, cre, cph] (<https://orcid.org/0000-0001-5660-1727>), Emmanuel Paradis [cph] (<https://orcid.org/0000-0003-3092-2199>)
Initial release

We don't support your browser anymore

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