]> git.donarmstrong.com Git - ape.git/blob - man/rtree.Rd
current 2.1 release
[ape.git] / man / rtree.Rd
1 \name{rtree}
2 \alias{rtree}
3 \alias{rcoal}
4 \title{Generates Random Trees}
5 \usage{
6 rtree(n, rooted = TRUE, tip.label = NULL, br = runif, ...)
7 rcoal(n, tip.label = NULL, br = rexp, ...)
8 }
9 \arguments{
10   \item{n}{an integer giving the number of tips in the tree.}
11   \item{rooted}{a logical indicating whether the tree should be rooted
12     (the default).}
13   \item{tip.label}{a character vector giving the tip labels; if not
14     specified, the tips "t1", "t2", ..., are given.}
15   \item{br}{either an R function used to generate the branch lengths
16     (\code{rtree}) or the coalescence times (\code{rcoal}), or
17     \code{NULL} to give no branch lengths in the tree.}
18   \item{...}{further argument(s) to be passed to \code{br}.}
19 }
20 \description{
21   These functions generate trees by splitting randomly the edges
22   (\code{rtree}) or randomly clustering the tips (\code{rcoal}).
23   \code{rtree} generates general (non-ultrametric) trees, and
24   \code{rcoal} generates coalescent (ultrametric) trees.
25 }
26 \details{
27   The trees generated are bifurcating. If \code{rooted = FALSE} in
28   (\code{rtree}), the tree is trifurcating at its `root'.
29
30   The default function to generate branch lengths in \code{rtree} is
31   \code{runif}. In \code{rcoal} \code{rexp} is used to generate the
32   inter-node distances. If further arguments are passed to \code{br},
33   they need to be tagged (e.g., \code{min = 0, max = 10}).
34 }
35 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
36 \examples{
37 layout(matrix(1:9, 3, 3))
38 ### Nine random trees:
39 for (i in 1:9) plot(rtree(20))
40 ### Nine random cladograms:
41 for (i in 1:9) plot(rtree(20, FALSE), type = "c")
42 ### generate 4 random trees of bird orders:
43 data(bird.orders)
44 layout(matrix(1:4, 2, 2))
45 for (i in 1:4)
46   plot(rcoal(23, tip.label = bird.orders$tip.label), no.margin = TRUE)
47 layout(matrix(1))
48 }
49 \keyword{datagen}