add_tip | R Documentation |
Add one or more tips below a parent node specified by its label.
add_tip(phy, label, parent_label)
phy |
A phylo object. The tree to manipulate. |
label |
A character vector containing tip labels. |
parent_label |
A character string containing the label of the parent node. |
The length of the branches, between the added tips and their parent node is set equal to the longest of the original branches directly below node n.
A phylo object containing the modified tree.
library(ape)
tree <- abridge_labels(get_glottolog_trees("LeftMay"))
tree <- ultrametricize(rescale_branches_exp(tree))
plot_glotto(tree)
# Attach one or more new tips to a tree:
tree2 <- add_tip(tree, label = "rockypeak", parent_label = "iter1240")
plot_glotto(tree2)
tree3 <- add_tip(tree, label = c("bo", "kaumifi"), parent_label = "bopa1235")
plot_glotto(tree3)
# Move tips by using remove_tip() and add_tip():
tree4 <- remove_tip(tree, "amap1240")
tree4a <- add_tip(tree4, "amap1240", parent_label = "left1242")
plot_glotto(tree4a)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.