expandTaxonTree(taxonTree, taxaData, collapse = NULL, keepBrLen = FALSE,
plot = FALSE)multi2di in the ape package or via the
various time-scaling functions found in this package
(paleotree).
The taxaData vector should have one element per lower-level
taxon that is to be added to the tree. The name of each
element in the vector should be the names of the
lower-level taxa, which will be used as new tip labels of
the output lower-taxon tree. There should be no empty
elements! expandTaxonTree won't know what to do with taxa
that don't go anywhere.
By default, all higher-level taxa are treated as
monophyletic clades if not otherwise specified. The
collapse vector can (and probably should) be used if there
is doubt about the monophyly of any higher-level taxa
included in the input taxon-tree, so that such a group
would be treated as a paraphyletic group in the output
tree.
Also by default, the output tree will lack branch lengths
and thus will not be time-scaled. If keepBrLen is true,
then the tree's edge lengths are kept and new taxa are
added as zero length branches attaching to a node that
represents the previous higher-taxon. This tree is probably
not useful for most applications, and may even strongly
bias some analyses. USE WITH CAUTION! The 'collapse' vector
will cause such edges to be replaced by zero-length
branches rather than fully collapsing them, which could
have odd effects. If 'collapse' is not null and keepBrLen
is true, a warning is issued that the output probably won't
make much sense at all.multi2di, bind.treeset.seed(444)
#lets make our hypothetical simulated tree of higher taxa
taxtr <- rtree(10)
taxd <- sample(taxtr$tip.label,30,replace=TRUE) #taxa to place within higher taxa
names(taxd) <- paste(taxd,"_x",1:30,sep="")
coll <- sample(taxtr$tip.label,3) #what to collapse?
expandTaxonTree(taxonTree=taxtr,taxaData=taxd,collapse=coll,plot=TRUE)Run the code above in your browser using DataLab