ape (version 1.3-1)

rtree: Generates Random Trees

Description

This function generates a tree by splitting randomly the edges until the specified number of tips is obtained.

Usage

rtree(n, br = TRUE)

Arguments

n
an integer giving the number of tips in the tree.
br
a logical specifying whether the tree should have branch lengths (default is TRUE).

Details

If br = TRUE, branch lengths are taken from a uniform distribution on [0, 1]. This is an experimental function and is not intended to generate trees with given statistical characteristics (at least for the moment). Its present purpose is to give a tree of a specified size in an easy way. To get an ultrametric tree, one may apply the function chronogram to the tree generated by rtree.

Examples

Run this code
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")
layout(matrix(1))

Run the code above in your browser using DataCamp Workspace