R/fleshoutGuidetree.R

fleshoutGuidetree <- function(phy, tax){
  
  if ( !inherits(phy, "phylo") )
    stop("'phy' is not of class 'phylo'")
  
  ## data frame containing species missing from phy
  ## ----------------------------------------------
  add <- tax[!tax$spec %in% phy$tip.label, ]
  cat("\nNumber of species to add:", nrow(add))
  gen.phy <- strip.spec(phy$tip.label)
  
  ## add via genus
  #for ( i in add$spec[add$gen %in% gen.phy]){
  for ( i in union(add$spec, NULL) ){ # union returns character!
    cat("\n.. ", i)
    phy <- addTip(phy, tip = i, tax = tax)
  }
  phy
}

Try the megaptera package in your browser

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

megaptera documentation built on Jan. 15, 2017, 11:19 p.m.