tipLength: Calculate distance to tips from ancestors

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Returns the edge length between each tip and its parent, or alternatively the total distance to each tip from the root node of the phylogeny.

Usage

1
  tipLength(phy, from=c("parent", "root"))

Arguments

phy

A phylo4 object (or one that inherits from it)

from

Should lengths represent distance from parents only (i.e., simply the lengths of terminal branches), or from the root node?

Details

When from is "parent", the function is a straightforward wrapper of the edgeLength function in the phylobase package. When from is "root", the function uses an implementation of Dijkstra's algorithm to compute the total distance from the root to each of the tips.

Value

Numeric vector of lengths, with the associated tip node labels as names.

Note

When calculating the distance from root, the length of the root edge itself is not included in the returned value. See examples for a simple way to add this additional edge to the result.

Author(s)

Jim Regetz (regetz@nceas.ucsb.edu)

See Also

Method edgeLength in the phylobase package.

Examples

1
2
3
4
5
6
7
8
9
  data(weeds)
  tipLength(weeds)

  # distance from the root node to each tip
  tipLength(weeds, from="root")

  # as above, but include root edge length
  tipLength(weeds, from="root") + edgeLength(weeds,
    rootNode(weeds))

eliotmiller/ecoPDcorr documentation built on May 16, 2019, 3:02 a.m.