View source: R/count_cherries.R
count_cherries | R Documentation |
Given a set of phylogenetic tree(s) returns the number of cherries in each one.
count_cherries(tree)
tree |
A tree (phylo or multiPhylo object). |
Cherries are components of a phylogenetic tree defined as internal nodes with exactly two terminal descendants.
This function simply counts the number present in a given tree.
Note that any fully dichotomous phylogenetic tree must have at least one cherry.
Returns a vector of cherry counts for each tree retaining the order in which they were supplied.
Graeme T. Lloyd graemetlloyd@gmail.com
# Create simple two-cherry tree:
tree <- ape::read.tree(text = "((A,B),(C,D));")
# Show count of cherries is two:
count_cherries(tree = tree)
# Create a star tree:
tree <- ape::read.tree(text = "(A,B,C,D);")
# Show count of cherries is zero:
count_cherries(tree = tree)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.