relabel_node: Change node labels

View source: R/labels.R

relabel_nodeR Documentation

Change node labels

Description

Replaces existing tip labels with new labels.

Usage

relabel_node(phy, label, new_label)

Arguments

phy

A phylo object.

label

A vector of strings, the node labels to be replaced.

new_label

A vector of strings, the same length as label. The corresponding replacement labels.

Examples


library(ape)

tree <- relabel_with_names(get_glottolog_trees("Tangkic"))
tree2 <- apply_duplicate_suffixes(clone_tip(tree, "Yangkaal", subgroup = TRUE))
plot(tree2)
tree3 <- relabel_tip(tree2, c("Kangkalita", "Yangkaal-1", "Yangkaal-2"), 
                     c("Gangalidda", "Yangkaal", "Yangarella"))
plot(tree3)
nodelabels(tree3$node.label)
tree4 <- relabel_node(tree3, c("Yangkaal", "Kayardild-Yangkaal"),
                      c("Yangkaralda", "Kayardild-Yangkaralda"))
plot(tree4)
nodelabels(tree4$node.label)

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