4 \title{Generates Random Trees}
6 rtree(n, rooted = TRUE, tip.label = NULL, br = runif, ...)
7 rcoal(n, tip.label = NULL, br = rexp, ...)
8 rmtree(N, n, rooted = TRUE, tip.label = NULL, br = runif, ...)
11 \item{n}{an integer giving the number of tips in the tree.}
12 \item{rooted}{a logical indicating whether the tree should be rooted
14 \item{tip.label}{a character vector giving the tip labels; if not
15 specified, the tips "t1", "t2", ..., are given.}
16 \item{br}{either an R function used to generate the branch lengths
17 (\code{rtree}) or the coalescence times (\code{rcoal}), or
18 \code{NULL} to give no branch lengths in the tree.}
19 \item{...}{further argument(s) to be passed to \code{br}.}
20 \item{N}{an integer giving the number of trees to generate.}
23 These functions generate trees by splitting randomly the edges
24 (\code{rtree}) or randomly clustering the tips (\code{rcoal}).
25 \code{rtree} generates general (non-ultrametric) trees, and
26 \code{rcoal} generates coalescent (ultrametric) trees.
29 The trees generated are bifurcating. If \code{rooted = FALSE} in
30 (\code{rtree}), the tree is trifurcating at its `root'.
32 The default function to generate branch lengths in \code{rtree} is
33 \code{runif}. In \code{rcoal} \code{rexp} is used to generate the
34 inter-node distances. If further arguments are passed to \code{br},
35 they need to be tagged (e.g., \code{min = 0, max = 10}).
37 \code{rmtree} calls successively \code{rmtree} and set the class of
38 the returned object appropriately.
41 An object of class \code{"phylo"} or of class \code{"multiPhylo"} in
42 the case of \code{rmtree}.
44 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
46 layout(matrix(1:9, 3, 3))
47 ### Nine random trees:
48 for (i in 1:9) plot(rtree(20))
49 ### Nine random cladograms:
50 for (i in 1:9) plot(rtree(20, FALSE), type = "c")
51 ### generate 4 random trees of bird orders:
53 layout(matrix(1:4, 2, 2))
55 plot(rcoal(23, tip.label = bird.orders$tip.label), no.margin = TRUE)