scale_tree: Scale a coancestry tree

Description Usage Arguments Value See Also Examples

View source: R/scale_tree.R

Description

Scale by a scalar factor all the edges ($edge.length) of a phylo object from the ape package, including the root edge ($root.edge) if present, and additive edges ($edge.length.add, present in trees returned by fit_tree()). Stops if any of the edges exceed 1 before or after scaling (since these edges are IBD probabilities).

Usage

1

Arguments

tree

The coancestry tree to edit.

factor

The scalar factor to multiply all edges. Must be non-negative, and not be so large that any edge exceeds 1 after scaling.

Value

The edited tree with all edges scaled as desired.

See Also

ape::read.tree() for reading phylo objects and their definition.

Examples

1
2
3
4
5
6
7
# create a random tree
library(ape)
k <- 5
tree <- rtree( k )

# scale this tree
tree_scaled <- scale_tree( tree, 0.5 )

bnpsd documentation built on Aug. 25, 2021, 5:07 p.m.