countSimmap: Counts the number of character changes on a object of class...

View source: R/utilities.R

countSimmapR Documentation

Counts the number of character changes on a object of class "simmap" or "multiSimmap"

Description

Count the number of changes of different types on a stochastically mapped trees or set of trees (objects of class "simmap" or "multiSimmap").

Usage

countSimmap(tree, states=NULL, message=TRUE)

Arguments

tree

an object of class "simmap" or "multiSimmap".

states

optional argument with the states for the mapped character. If not provided, these will be computed from the tree. This is useful if averaging across many trees, some of which may lack certain states.

message

optional logical argument indicating whether or not to return an informative message about the function output.

Details

This function takes a tree or a set of trees with a mapped discrete character (that is, an object of class "simmap" or "multiSimmap"), and computes the total number of character changes as well as the number of character changes between all states.

Value

A list with up to three elements: N is an integer value giving the total number of character changes on the tree; Tr gives the number of of transitions between row and column states (or a matrix containing both N and the transitions between states, in rows, for an object of class "multiPhylo"); and (optionally) message contains an explanatory message about the function output.

Author(s)

Liam Revell liam.revell@umb.edu

References

Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.

Examples

## load data from Revell & Collar (2009)
data(anoletree)
anoletree
countSimmap(anoletree)

phytools documentation built on June 22, 2024, 10:39 a.m.