getTreeStats: Return large list of trees stats by node

Description Usage Details Examples

Description

Returns a list object of nodes with information on each node – see details.

Usage

1

Details

Many functions require the navigation of a tree e.g. finding all descending nodes, counting number of children by node etc. MoreTreeTools has many functions for performing these tasks, but in cases where these function need to be run multiple times it can be more efficient to generate this information beforehand.

A list object is returned, with stats for each node. Stats generated are:

Note, this function assumes trees are rooted. If no branch lengths are given, the function sets all branch lengths to 1. The function is recursive, for very large trees (100,000 + tips) a stack overflow warning may appear. Update options(expressions=) to change the stack limit.

Examples

1
2
3
4
5
6
7
8
9
# get hominoids tree
data ('hominoids')
# plot with labels
plot (hominoids);nodelabels();edgelabels();axisPhylo();
# generate tree.stats
tree.stats <- getTreeStats (hominoids)
# corroborate with plot
tree.stats[[19]][['prev.edges']]  # the previous edge for node 19 is 2
tree.stats[[20]][['children']]  # all the 'great' apes descend from node 20

DomBennett/MoreTreeTools documentation built on May 6, 2019, 2:51 p.m.