add_tip: Add tips to a tree

add_tipR Documentation

Add tips to a tree

Description

Add one or more tips below a parent node specified by its label.

Usage

add_tip(phy, label, parent_label)

Arguments

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.

Details

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.

Value

A phylo object containing the modified tree.

Examples


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)

erichround/glottoTrees documentation built on April 17, 2025, 10:47 a.m.