tree.bind: Randomly binding trees together

View source: R/tree.bind.R

tree.bindR Documentation

Randomly binding trees together

Description

Randomly binds trees together with a provided number of trees and a root age.

Usage

tree.bind(x, y, sample, root.age)

Arguments

x, y

Two phylo or multiPhylo objects.

sample

The number of trees to create. If missing, the sample size is set to 1.

root.age

The age of the root where both trees are combined (can be any unit). If missing, the root.edge is set to 0.

Value

If x, y and sample are >1, the function returns a multiPhylo object; else it returns a phylo object.

Author(s)

Thomas Guillerme

Examples

## Combines 2 randomly chosen trees from x and from y into z putting the root age at 12.
x <- rmtree(10, 5) ; y <- rmtree(5, 5)
tree.bind(x, y, sample = 3, root.age = 12)

##Combines one mammal and and one bird tree and setting the root age at 250 Mya.
data(lifespan)
combined_trees <- tree.bind(trees_mammalia, trees_aves, sample = 1, root.age = 250)
plot(combined_trees) # A tree with both mammals and aves


TGuillerme/mulTree documentation built on Feb. 21, 2024, 9:18 a.m.