scale_tree {bnpsd} | R Documentation |
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).
scale_tree(tree, factor)
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. |
The edited tree with all edges scaled as desired.
ape::read.tree()
for reading phylo
objects and their definition.
# create a random tree library(ape) k <- 5 tree <- rtree( k ) # scale this tree tree_scaled <- scale_tree( tree, 0.5 )