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}{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.}
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.
31 The trees generated are bifurcating. If \code{rooted = FALSE} in
32 (\code{rtree}), the tree is trifurcating at its root.
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}).
38 \code{rmtree} calls successively \code{rtree} and set the class of
39 the returned object appropriately.
42 An object of class \code{"phylo"} or of class \code{"multiPhylo"} in
43 the case of \code{rmtree}.
45 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
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:
54 layout(matrix(1:4, 2, 2))
56 plot(rcoal(23, tip.label = bird.orders$tip.label), no.margin = TRUE)