]> git.donarmstrong.com Git - ape.git/blob - man/rtree.Rd
63cbf79e5f8a2c1f74602c0845be3140bb2f5fdc
[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 rmtree(N, n, rooted = TRUE, tip.label = NULL, br = runif, ...)
9 }
10 \arguments{
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
13     (the default).}
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.}
21 }
22 \description{
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.
27 }
28 \details{
29   The trees generated are bifurcating. If \code{rooted = FALSE} in
30   (\code{rtree}), the tree is trifurcating at its `root'.
31
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}).
36
37   \code{rmtree} calls successively \code{rmtree} and set the class of
38   the returned object appropriately.
39 }
40 \value{
41   An object of class \code{"phylo"} or of class \code{"multiPhylo"} in
42   the case of \code{rmtree}.
43 }
44 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
45 \examples{
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:
52 data(bird.orders)
53 layout(matrix(1:4, 2, 2))
54 for (i in 1:4)
55   plot(rcoal(23, tip.label = bird.orders$tip.label), no.margin = TRUE)
56 layout(matrix(1))
57 }
58 \keyword{datagen}