distNode: Calculate the distance between any two nodes on the tree

View source: R/tree_distNode.R

distNodeR Documentation

Calculate the distance between any two nodes on the tree

Description

distNode is to calculate the distance between any two nodes on a phylo tree

Usage

distNode(tree, node)

Arguments

tree

A phylo object.

node

A numeric or character vector of length two.

Value

A numeric value.

Examples

library(ggtree)
data(tinyTree)
ggtree(tinyTree) +
    geom_text2(aes(label = node), color = "darkorange",
           hjust = -0.1, vjust = -0.7) +
    geom_text2(aes(label = branch.length), color = "darkblue",
               vjust = 0.7)


distNode(tree = tinyTree, node = c(10, 11))
distNode(tree = tinyTree, node = c(12, 13))
distNode(tree = tinyTree, node = c(13, 15))
distNode(tree = tinyTree, node = c(12, 14))

fionarhuang/TreeSummarizedExperiment documentation built on June 11, 2025, 9:42 a.m.