7 \alias{[[<-.multiPhylo}
9 \title{Manipulating Lists of Trees}
11 These are extraction and replacement operators for lists of trees
12 stored in the class \code{"multiPhylo"}.
15 \method{[}{multiPhylo}(x, i)
16 \method{[[}{multiPhylo}(x, i)
17 \method{$}{multiPhylo}(x, name)
18 \method{[}{multiPhylo}(x, ...) <- value
19 \method{[[}{multiPhylo}(x, ...) <- value
20 \method{$}{multiPhylo}(x, ...) <- value
23 \item{x, value}{an object of class \code{"phylo"} or \code{"multiPhylo"}.}
24 \item{i}{index(ices) of the tree(s) to select from a list; this may be a
25 vector of integers, logicals, or names.}
26 \item{name}{a character string specifying the tree to be extracted.}
27 \item{\dots}{index(ices) of the tree(s) to replace; this may be a
28 vector of integers, logicals, or names.}
31 The subsetting operator \code{[} keeps the class correctly
32 (\code{"multiPhylo"}).
34 The replacement operators check the labels of \code{value} if \code{x}
35 has a single vector of tip labels for all trees (see examples).
38 An object of class \code{"phylo"} (\code{[[}, \code{$}) or of class
39 \code{"multiPhylo"} (\code{[} and the replacement operators).
41 \author{Emmanuel Paradis}
43 \code{\link{summary.phylo}}, \code{\link{c.phylo}}
47 names(x) <- paste("tree", 1:10, sep = "")
51 x$tree1 # same than above
54 y <- .compressTipLabel(x)
55 ## up to here 'x' and 'y' have exactly the same information
56 ## but 'y' has a unique vector of tip labels for all the trees
57 x[[1]] <- rtree(10) # no error
58 try(y[[1]] <- rtree(10)) # error
60 try(x[1] <- rtree(20)) # error
61 ## use instead one of the two:
62 x[1] <- list(rtree(20))
65 x[1:5] <- rmtree(5, 20) # replacement
66 x[11:20] <- rmtree(10, 20) # elongation