File: multiphylo.Rd

package info (click to toggle)
r-cran-ape 5.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,932 kB
  • sloc: ansic: 7,626; cpp: 116; sh: 17; makefile: 2
file content (67 lines) | stat: -rw-r--r-- 1,897 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
\name{multiphylo}
\alias{multiphylo}
\alias{[.multiPhylo}
\alias{[[.multiPhylo}
\alias{$.multiPhylo}
\alias{[<-.multiPhylo}
\alias{[[<-.multiPhylo}
\alias{$<-.multiPhylo}
\title{Manipulating Lists of Trees}
\description{
  These are extraction and replacement operators for lists of trees
  stored in the class \code{"multiPhylo"}.
}
\usage{
\method{[}{multiPhylo}(x, i)
\method{[[}{multiPhylo}(x, i)
\method{$}{multiPhylo}(x, name)
\method{[}{multiPhylo}(x, i) <- value
\method{[[}{multiPhylo}(x, i) <- value
\method{$}{multiPhylo}(x, i) <- value
}
\arguments{
  \item{x, value}{an object of class \code{"phylo"} or \code{"multiPhylo"}.}
  \item{i}{index(ices) of the tree(s) to select from a list; this may be a
    vector of integers, logicals, or names.}
  \item{name}{a character string specifying the tree to be extracted.}
}
\details{
  The subsetting operator \code{[} keeps the class correctly
  (\code{"multiPhylo"}).

The replacement operators check the labels of \code{value} if \code{x}
has a single vector of tip labels for all trees (see examples).
}
\value{
  An object of class \code{"phylo"} (\code{[[}, \code{$}) or of class
  \code{"multiPhylo"} (\code{[} and the replacement operators).
}
\author{Emmanuel Paradis}
\seealso{
  \code{\link{summary.phylo}}, \code{\link{c.phylo}}
}
\examples{
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
}
\keyword{manip}