5 \title{Generates Random Trees}
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, ...)
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
15 \item{tip.label}{a character vector giving the tip labels; if not
16 specified, the tips "t1", "t2", ..., are given.}
17 \item{br}{one of the following: (i) an R function used to generate the
18 branch lengths (\code{rtree}; use \code{NULL} to simulate only a
19 topology), or the coalescence times (\code{rcoal}); (ii) a character
20 to simulate a genuine coalescent tree for \code{rcoal} (the
21 default); or (iii) a numeric vector for the branch lengths or the
23 \item{\dots}{further argument(s) to be passed to \code{br}.}
24 \item{N}{an integer giving the number of trees to generate.}
27 These functions generate trees by splitting randomly the edges
28 (\code{rtree}) or randomly clustering the tips (\code{rcoal}).
29 \code{rtree} generates general (non-ultrametric) trees, and
30 \code{rcoal} generates coalescent (ultrametric) trees.
33 The trees generated are bifurcating. If \code{rooted = FALSE} in
34 (\code{rtree}), the tree is trifurcating at its root.
36 The default function to generate branch lengths in \code{rtree} is
37 \code{runif}. If further arguments are passed to \code{br}, they need
38 to be tagged (e.g., \code{min = 0, max = 10}).
40 \code{rmtree} calls successively \code{rtree} and set the class of
41 the returned object appropriately.
44 An object of class \code{"phylo"} or of class \code{"multiPhylo"} in
45 the case of \code{rmtree}.
47 \author{Emmanuel Paradis}
49 \code{\link{stree}}, \code{\link{rlineage}}
52 layout(matrix(1:9, 3, 3))
53 ### Nine random trees:
54 for (i in 1:9) plot(rtree(20))
55 ### Nine random cladograms:
56 for (i in 1:9) plot(rtree(20, FALSE), type = "c")
57 ### generate 4 random trees of bird orders:
59 layout(matrix(1:4, 2, 2))
61 plot(rcoal(23, tip.label = bird.orders$tip.label), no.margin = TRUE)