# multiphylo

From ape v5.4
0th

Percentile

##### Manipulating Lists of Trees

These are extraction and replacement operators for lists of trees stored in the class "multiPhylo".

Keywords
manip
##### Usage
# S3 method for multiPhylo
[(x, i)
# S3 method for multiPhylo
[[(x, i)
# S3 method for multiPhylo
$(x, name) # S3 method for multiPhylo [(x, ...) <- value # S3 method for multiPhylo [[(x, ...) <- value # S3 method for multiPhylo$(x, ...) <- value
##### Arguments
x, value

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

i

index(ices) of the tree(s) to select from a list; this may be a vector of integers, logicals, or names.

name

a character string specifying the tree to be extracted.

index(ices) of the tree(s) to replace; this may be a vector of integers, logicals, or names.

##### Details

The subsetting operator [ keeps the class correctly ("multiPhylo").

The replacement operators check the labels of value if x has a single vector of tip labels for all trees (see examples).

An object of class "phylo" ([[, $) or of class "multiPhylo" ([ and the replacement operators). ##### See Also summary.phylo, c.phylo ##### Aliases • multiphylo • [.multiPhylo • [[.multiPhylo •$.multiPhylo
• [<-.multiPhylo
• [[<-.multiPhylo
• $<-.multiPhylo ##### Examples # NOT RUN { x <- rmtree(10, 20) names(x) <- paste("tree", 1:10, sep = "") x[1:5] x[1] # subsetting x[[1]] # extraction x$tree1 # same than above
x[[1]] <- rtree(20)

y <- .compressTipLabel(x)
## up to here 'x' and 'y' have exactly the same information
## but 'y' has a unique vector of tip labels for all the trees
x[[1]] <- rtree(10) # no error
try(y[[1]] <- rtree(10)) # error

try(x[1] <- rtree(20)) # error
## use instead one of the two:
x[1] <- list(rtree(20))
x[1] <- c(rtree(20))

x[1:5] <- rmtree(5, 20) # replacement
x[11:20] <- rmtree(10, 20) # elongation
x # 20 trees
# }

Documentation reproduced from package ape, version 5.4, License: GPL-2 | GPL-3

### Community examples

Looks like there are no examples yet.