rtree

0th

Percentile

Generates Random Trees

These functions generate trees by splitting randomly the edges (rtree) or randomly clustering the tips (rcoal). rtree generates general (non-ultrametric) trees, and rcoal generates coalescent (ultrametric) trees.

Keywords
datagen
Usage
rtree(n, rooted = TRUE, tip.label = NULL, br = runif, ...)
rcoal(n, tip.label = NULL, br = "coalescent", ...)
rmtree(N, n, rooted = TRUE, tip.label = NULL, br = runif, ...)
Arguments
n
an integer giving the number of tips in the tree.
rooted
a logical indicating whether the tree should be rooted (the default).
tip.label
a character vector giving the tip labels; if not specified, the tips "t1", "t2", ..., are given.
br
one of the following: (i) an Rfunction used to generate the branch lengths (rtree; use NULL to simulate only a topology), or the coalescence times (rcoal); (ii) a character to simulate a genuine coalescen
...
further argument(s) to be passed to br.
N
an integer giving the number of trees to generate.
Details

The trees generated are bifurcating. If rooted = FALSE in (rtree), the tree is trifurcating at its root.

The default function to generate branch lengths in rtree is runif. If further arguments are passed to br, they need to be tagged (e.g., min = 0, max = 10).

rmtree calls successively rtree and set the class of the returned object appropriately.

Value

  • An object of class "phylo" or of class "multiPhylo" in the case of rmtree.

See Also

stree, rlineage

Aliases
  • rtree
  • rcoal
  • rmtree
Examples
layout(matrix(1:9, 3, 3))
### Nine random trees:
for (i in 1:9) plot(rtree(20))
### Nine random cladograms:
for (i in 1:9) plot(rtree(20, FALSE), type = "c")
### generate 4 random trees of bird orders:
data(bird.orders)
layout(matrix(1:4, 2, 2))
for (i in 1:4)
  plot(rcoal(23, tip.label = bird.orders$tip.label), no.margin = TRUE)
layout(matrix(1))
Documentation reproduced from package ape, version 2.7-3, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.