add.tree {dispRity}R Documentation

Add, remove or get trees (or subtrees)

Description

Adding, extracting or removing the tree component from a dispRity object.

Usage

add.tree(data, tree, replace = FALSE)

get.tree(data, subsets = FALSE, to.root = FALSE)

remove.tree(data)

Arguments

data

A dispRity object.

tree

A phylo or mutiPhylo object.

replace

Logical, whether to replace any existing tree (TRUE) or add to it (FALSE; default).

subsets

Either a logical whether to extract the tree for each subset (TRUE) or not (FALSE; default) or specific subset names or numbers.

to.root

Logical, whether to return the subset tree including the root of the tree (TRUE) or only containing the elements in the subset (and their most recent common ancestor; FALSE; default). If data contains time bins (from chrono.subsets with method = "discrete"), and to.root = FALSE it returns the subtrees containing only what's in the bin.

Details

get.tree allows to extract the trees specific to each subsets.

Author(s)

Thomas Guillerme and Jack Hadfield

See Also

custom.subsets, chrono.subsets, boot.matrix, dispRity.

Examples

## Loading a dispRity object
data(disparity)
## Loading a tree
data(BeckLee_tree)

## Removing  the tree from the dispRity object
(tree_data <- remove.tree(disparity))

## Extracting the tree
get.tree(tree_data) # is null

## Adding a tree to the disparity object
tree_data <- add.tree(tree_data, tree = BeckLee_tree)

## Extracting the tree
get.tree(tree_data) # is a "phylo" object

## Adding the same tree again
tree_data <- add.tree(tree_data, tree = BeckLee_tree)
get.tree(tree_data) # is a "multiPhylo" object (2 trees)

## Replacing the two trees by one tree
tree_data <- add.tree(tree_data, tree = BeckLee_tree, replace = TRUE)
get.tree(tree_data) # is a "phylo" object


[Package dispRity version 1.8 Index]