edgeLength-methods: edgeLength methods

Description Usage Arguments Details Value See Also Examples

Description

These functions give information about and allow replacement of edge lengths.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
hasEdgeLength(x)

## S4 method for signature 'phylo4'
hasEdgeLength(x)

edgeLength(x, ...)

## S4 method for signature 'phylo4'
edgeLength(x, node)

edgeLength(x, use.names = TRUE, ...) <- value

depthTips(x)

## S4 method for signature 'phylo4'
depthTips(x)

nodeDepth(x, node)

## S4 method for signature 'phylo4'
nodeDepth(x, node)

sumEdgeLength(x, node)

## S4 method for signature 'phylo4'
sumEdgeLength(x, node)

isUltrametric(x, tol = .Machine$double.eps^0.5)

## S4 method for signature 'phylo4'
isUltrametric(x, tol = .Machine$double.eps^0.5)

Arguments

x

a phylo4 or phylo4d object.

value

a numeric vector indicating the new values for the edge lengths

node

optional numeric or character vector indicating the nodes for which edge

use.names

should the the name attributes of value be used to match the length to a given edge.

tol

the tolerance to decide whether all the tips have the same depth to test if the tree is ultrametric. Default is .Machine$double.eps^0.5.

...

optional arguments (none used at present).

Details

The edgeLength function returns the edge length in the same order as the edges in the matrix.

Value

hasEdgeLength

whether or not the object has edge lengths (logical)

edgeLength

a named vector of the edge length for the object

nodeDepth

a named vector indicating the “depth” (the distance between the root and the tip) of each tip.

isUltrametric

whether or not the tree is ultrametric (all the tips are have the same depth (distance from the root) (logical)

sumEdgeLength

the sum of the edge lengths for a set of nodes (intended to be used with ancestors or descendants)

See Also

ancestors, descendants, .Machine for more information about tolerance.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(geospiza)
  hasEdgeLength(geospiza) # TRUE
  topoGeo <- geospiza
  edgeLength(topoGeo) <- NULL
  hasEdgeLength(topoGeo)  # FALSE

  edgeLength(geospiza)[2]       # use the position in vector
  edgeLength(geospiza)["16-17"] # or the name of the edge
  edgeLength(geospiza, 17)      # or the descendant node of the edge

  ## The same methods can be used to update an edge length
  edgeLength(geospiza)[2] <- 0.33
  edgeLength(geospiza)["16-17"] <- 0.34
  edgeLength(geospiza, 17) <- 0.35

phylobase documentation built on May 2, 2019, 6:49 p.m.