R: Add tree to start of list

UnshiftTree {TreeTools} | R Documentation

## Add tree to start of list

### Description

`UnshiftTree()` adds a phylogenetic tree to the start of a list of trees. This is useful where the class of a list of trees is unknown.

### Usage

    UnshiftTree(add, treeList)

### Arguments

`add` | Tree to add to the list, of class `phylo`.
`treeList` | A list of trees, of class `list`, `multiPhylo`, or, if a single tree, `phylo`.

### Details

Caution: adding a tree to a `multiPhylo` object whose own attributes apply to all trees, for example trees read from a Nexus file, causes data to be lost.

### Value

`UnshiftTree()` returns a list of class `list` or `multiPhylo` (following the original class of `treeList`), whose first element is the tree specified as 'add.

### Author(s)

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

### Examples

    forest <- as.phylo(0:5, 6)
    tree <- BalancedTree(6)

    UnshiftTree(tree, forest)
    UnshiftTree(tree, tree)

[Package TreeTools version 1.2.0 Index]