| GenerateTree | R Documentation |
RandomTree(), PectinateTree(), BalancedTree() and StarTree()
generate trees with the specified shapes and leaf labels.
RandomTree(tips, root = FALSE, nodes, lengths = NULL)
YuleTree(tips, addInTurn = FALSE, root = TRUE, lengths = NULL)
PectinateTree(tips, lengths = NULL)
BalancedTree(tips, lengths = NULL)
StarTree(tips, lengths = NULL)
tips |
An integer specifying the number of tips, or a character vector
naming the tips, or any other object from which |
root |
Character or integer specifying tip to use as root;
or |
nodes |
Number of nodes to generate. The default and maximum,
|
lengths |
Numeric vector of edge lengths, or a function that returns
such a vector when passed the number of edges as its argument (e.g. |
addInTurn |
Logical specifying whether to add leaves in the order of
|
Each function returns an unweighted binary tree of class phylo with
the specified leaf labels. Trees are rooted unless root = FALSE.
RandomTree() returns a topology drawn at random from the uniform
distribution (i.e. each binary tree is drawn with equal probability).
Trees are generated by inserting
each tip in term at a randomly selected edge in the tree.
Random numbers are generated using a Mersenne Twister.
If root = FALSE, the tree will be unrooted, with the first tip in a
basal position. Otherwise, the tree will be rooted on root.
YuleTree() returns a topology generated by the Yule process
\insertCiteSteel2001TreeTools,
i.e. adding leaves in turn adjacent to a randomly-chosen existing leaf.
PectinateTree() returns a pectinate (caterpillar) tree.
BalancedTree() returns a balanced (symmetrical) tree, in preorder.
StarTree() returns a completely unresolved (star) tree.
Martin R. Smith (martin.smith@durham.ac.uk)
()
Other tree generation functions:
ConstrainedNJ(),
NJTree(),
TreeNumber,
TrivialTree
# Set random seed for reproducibility
set.seed(10)
# Generate a tree from a phylogenetic dataset
data("Lobo")
RandomTree(Lobo.phy, lengths = runif)
# Generate trees on letters A-J
plot(RandomTree(LETTERS[1:10], root = TRUE))
plot(YuleTree(LETTERS[1:10]))
plot(PectinateTree(LETTERS[1:10]))
plot(BalancedTree(LETTERS[1:10], lengths = 1:18))
plot(StarTree(LETTERS[1:10]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.