DropTip()
removes specified tips from a phylogenetic tree, collapsing
incident branches.
DropTip(tree, tip, preorder = TRUE, check = TRUE)# S3 method for phylo
DropTip(tree, tip, preorder = TRUE, check = TRUE)
DropTipPhylo(tree, tip, preorder = TRUE, check = TRUE)
# S3 method for multiPhylo
DropTip(tree, tip, preorder = TRUE, check = TRUE)
KeepTip(tree, tip, preorder = TRUE, check = TRUE)
A tree of class phylo
.
Character vector specifying labels of leaves in tree to be dropped, or integer vector specifying the indices of leaves to be dropped. Specifying the index of an internal node will drop all descendants of that node.
Logical specifying whether to Preorder the tree before dropping tips. Necessary if a tree's edges may be unconventionally numbered.
Logical specifying whether to check validity of tip
. If
FALSE
and tip
contains entries that do not correspond to leaves of the
tree, undefined behaviour may occur.
DropTip()
returns a tree of class phylo
, with the requested
leaves removed.
KeepTip()
returns tree
with all leaves not in tip
removed,
in preorder.
DropTipPhylo
: Direct call to DropTip.phylo()
, to avoid overhead of
querying object's class.
This function is more robust than ape::drop.tip()
as it does not
require any particular internal node numbering schema.
Other tree manipulation:
AddTip()
,
CollapseNode()
,
ConsensusWithout()
,
EnforceOutgroup()
,
ImposeConstraint()
,
LeafLabelInterchange()
,
MakeTreeBinary()
,
RenumberTips()
,
RenumberTree()
,
Renumber()
,
RootTree()
,
SingleTaxonTree()
,
SortTree()
,
Subtree()
# NOT RUN {
tree <- BalancedTree(8)
plot(tree)
plot(DropTip(tree, c('t4', 't5')))
# }
Run the code above in your browser using DataLab