rescale_branches_constrained: Exponentialize branch lengths using constraints

View source: R/branch_lengths.R

rescale_branches_constrainedR Documentation

Exponentialize branch lengths using constraints

Description

Sets the branches furthest from the root to shortest_length and then scales other branches exponentially in such a way that the total tree has a height of tree_height.

Usage

rescale_branches_constrained(phy, tree_height, shortest_length)

Arguments

phy

A phylo object, the tree to manipulate.

tree_height

A positive numeric, the desired height of the whole tree.

shortest_length

A positive numeric, the desired length of the shortest branches, i.e., the branches farthest from the root.

Value

A phylo object, the manipulated tree.

Examples


library(ape)
tree <- abridge_labels(get_glottolog_trees("Siouan"))
plot_glotto(tree)
tree2 <- rescale_branches_constrained(tree, tree_height = 2000, shortest_length = 200)
plot_glotto(tree2)
tree3 <- rescale_branches_constrained(tree, tree_height = 2000, shortest_length = 100)
plot_glotto(tree3)

erichround/glottoTrees documentation built on April 17, 2025, 10:47 a.m.