R/get_path_length.r

Defines functions get_path_length

Documented in get_path_length

#' Extract phylogenetic path lengths
#'
#' @description This function extracts the phylogenetic path lengths or
#'   root-to-tip divergences from a molecular tree or a non-ultrametric
#'   timetree.
#'
#' @param tree An object of class `phylo`
#'
#' @return This function returns a vector of path lengths.
#'
#' @author Kevin Surya
#'
#' @import ape
#'
#' @export
#'
get_path_length <- function(tree) {
  path <- diag(vcv(phy = tree))
  return(path)
}
suryakevin/drugcandy documentation built on May 6, 2022, 6:37 p.m.