R/node.sons.R

node.sons <-
function(phy, node)#Thanks to Julien Dutheil - code from earlier version of APE
{
  if (!("phylo" %in% class(phy))) stop("Object \"phy\" is not of class \"phylo\"") 
  E <- phy$edge
  n <- dim(E)[1]
  sons <- numeric(0)
  count <- 1
  for(i in 1:n) {
    if(E[i,1] == node) {
      sons[count] <- E[i,2];
      count <- count + 1
    }
  } 
  return(sons)
}

Try the iteRates package in your browser

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

iteRates documentation built on May 2, 2019, 9:12 a.m.