clade.members: Identify tips descended from a node

View source: R/clade.members.R

clade.membersR Documentation

Identify tips descended from a node

Description

Obtains a vector of the tips subtending from either one node or all nodes in a phylogeny.

Usage

clade.members(x, phy, tip.labels = FALSE, include.nodes=FALSE)
clade.members.list(phy, tips = FALSE, tip.labels = FALSE, include.nodes=FALSE)

Arguments

x

A integer identifying the node for which a list of tips is required.

phy

An object of class 'phylo'.

tips

A logical indicating whether to include external node membership in the list.

tip.labels

A logical flag indicating whether to return the node numbers of the tips or their tip labels.

include.nodes

A logical flag indicating whether to return the node number of descendent internal nodes

Details

The function clade.members.list runs clade.members over each node in the phylogeny, possibly including the external nodes as indicated by the tips argument, and returns a list of vectors showing the members of the clade defined by each node.

Value

A numeric vector of external node (i.e. tip) numbers or a character vector of tip labels for a single internal node or, for clade.members.list, a list of such vector for all nodes in the phylogeny. If include.nodes is TRUE then clade.members returns a list of length two containing a vector of the descendent tips and a vector of the descendent internal nodes - clade.members.list then contains a list of such lists.

Author(s)

David Orme, Lynsey McInnes

Examples

data(perissodactyla)
# use comparative.data to add node labels
perisso <- comparative.data(perissodactyla.tree, perissodactyla.data, Binomial, na.omit=FALSE)
plot(perisso$phy, show.node.label=TRUE)
clade.members(22, perisso$phy, tip.labels=TRUE)
clade.members.list(perisso$phy, tip.labels=FALSE)


caper documentation built on Sept. 26, 2023, 5:10 p.m.