R/number_of_lineages.R

Defines functions number_of_lineages

Documented in number_of_lineages

#' Number of tips of a tree, including extinct tips.
#' @param phy phylo object
#' @return number of lineages
#' @export
number_of_lineages <- function(phy) {
  if (inherits(phy, "matrix")) {
    return(length(phy[, 1]))
  }

  if (inherits(phy, "phylo")) {
      return(length(phy$tip.label))
  }
  stop("input object has to be phylo or ltable")
}

Try the treestats package in your browser

Any scripts or data that you put into this service are public.

treestats documentation built on Sept. 14, 2024, 9:08 a.m.