Learn R Programming

Claddis (version 0.7.0)

count_cherries: Counts the number of cherries in a tree

Description

Given a set of phylogenetic tree(s) returns the number of cherries in each one.

Usage

count_cherries(tree)

Value

Returns a vector of cherry counts for each tree retaining the order in which they were supplied.

Arguments

tree

A tree (phylo or multiPhylo object).

Author

Graeme T. Lloyd graemetlloyd@gmail.com

Details

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.

Examples

Run this code

# 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)

Run the code above in your browser using DataLab