]> git.donarmstrong.com Git - ape.git/blob - man/rtree.Rd
final changes for ape 2.4 including removing mlphylo!
[ape.git] / man / rtree.Rd
1 \name{rtree}
2 \alias{rtree}
3 \alias{rcoal}
4 \alias{rmtree}
5 \title{Generates Random Trees}
6 \usage{
7 rtree(n, rooted = TRUE, tip.label = NULL, br = runif, ...)
8 rcoal(n, tip.label = NULL, br = "coalescent", ...)
9 rmtree(N, n, rooted = TRUE, tip.label = NULL, br = runif, ...)
10 }
11 \arguments{
12   \item{n}{an integer giving the number of tips in the tree.}
13   \item{rooted}{a logical indicating whether the tree should be rooted
14     (the default).}
15   \item{tip.label}{a character vector giving the tip labels; if not
16     specified, the tips "t1", "t2", ..., are given.}
17   \item{br}{an R function used to generate the branch lengths
18     (\code{rtree}; use \code{NULL} to simulate only a topology), or the
19     coalescence times (\code{rcoal}). For the latter, a genuine
20     coalescent tree is simulated by default.}
21   \item{...}{further argument(s) to be passed to \code{br}.}
22   \item{N}{an integer giving the number of trees to generate.}
23 }
24 \description{
25   These functions generate trees by splitting randomly the edges
26   (\code{rtree}) or randomly clustering the tips (\code{rcoal}).
27   \code{rtree} generates general (non-ultrametric) trees, and
28   \code{rcoal} generates coalescent (ultrametric) trees.
29 }
30 \details{
31   The trees generated are bifurcating. If \code{rooted = FALSE} in
32   (\code{rtree}), the tree is trifurcating at its root.
33
34   The default function to generate branch lengths in \code{rtree} is
35   \code{runif}. If further arguments are passed to \code{br}, they need
36   to be tagged (e.g., \code{min = 0, max = 10}).
37
38   \code{rmtree} calls successively \code{rtree} and set the class of
39   the returned object appropriately.
40 }
41 \value{
42   An object of class \code{"phylo"} or of class \code{"multiPhylo"} in
43   the case of \code{rmtree}.
44 }
45 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
46 \examples{
47 layout(matrix(1:9, 3, 3))
48 ### Nine random trees:
49 for (i in 1:9) plot(rtree(20))
50 ### Nine random cladograms:
51 for (i in 1:9) plot(rtree(20, FALSE), type = "c")
52 ### generate 4 random trees of bird orders:
53 data(bird.orders)
54 layout(matrix(1:4, 2, 2))
55 for (i in 1:4)
56   plot(rcoal(23, tip.label = bird.orders$tip.label), no.margin = TRUE)
57 layout(matrix(1))
58 }
59 \keyword{datagen}