c.phylo

0th

Percentile

Building Lists of Trees

These functions help to build lists of trees of class "multiPhylo".

Keywords
manip
Usage
# S3 method for phylo
c(..., recursive = TRUE)
# S3 method for multiPhylo
c(..., recursive = TRUE)
.compressTipLabel(x, ref = NULL)
.uncompressTipLabel(x)
Arguments

one or several objects of class "phylo" and/or "multiPhylo".

recursive

see details.

x

an object of class "phylo" or "multiPhylo".

ref

an optional vector of mode character to constrain the order of the tips. By default, the order from the first tree is used.

Details

These c methods check all the arguments, and return by default a list of single trees unless some objects are not trees or lists of trees, in which case recursive is switched to FALSE and a warning message is given. If recursive = FALSE, the objects are simply concatenated into a list. Before ape 4.0, recursive was always set to FALSE.

.compressTipLabel transforms an object of class "multiPhylo" by checking that all trees have the same tip labels and renumbering the tips in the edge matrix so that the tip numbers are also the same taking the first tree as the reference (duplicated labels are not allowed). The returned object has a unique vector of tip labels (attr(x, "TipLabel")).

.uncompressTipLabel does the reverse operation.

Value

An object of class "multiPhylo".

See Also

summary.phylo, multiphylo

Aliases
  • c.phylo
  • c.multiPhylo
  • .compressTipLabel
  • .uncompressTipLabel
Examples
# NOT RUN {
x <- c(rtree(4), rtree(2))
x
y <- c(rtree(4), rtree(4))
z <- c(x, y)
z
print(z, TRUE)
try(.compressTipLabel(x)) # error
a <- .compressTipLabel(y)
.uncompressTipLabel(a) # back to y
## eventually compare str(a) and str(y)
# }
Documentation reproduced from package ape, version 4.1, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.