Refactoring R’s dendrapply
Published:
As someone who specializes in comparative phylogenomics, I work a lot with phylogenetic trees. Trees are represented in R as dendrogram
objects, which are essentially a series of nested lists. Each “node” of the tree is a list with multiple members (two if a binary tree, but dendrogram
objects are not constrained to be binary), each of which is another dendrogram
object. The leaves are special cases in that they have length 1 and an additional property leaf
, which is set to TRUE
.