relabel_with_names | R Documentation |
Looks up glottolog language names corresponding to glottocodes and replaces tip and node labels, which contain glottocodes, with the appropriate names.
relabel_with_names(phy, glottolog_version)
phy |
A phylo object, the tree to manipulate. |
glottolog_version |
A character string, specifying which glottolog
version to use. Currently available options are |
Also recognizes and retains duplicate suffixes, i.e., a hyphen followed by one or more numerals at the end of the string (see apply_duplicate_suffixes).
Labels without glottocodes are left unchanged and a warning is given. The
version of glottolog to use for look-up can be controlled with
glottolog_version
.
A phylo object, the manipulated tree.
library(ape)
# Replace full glottolog labels with names
tree <- get_glottolog_trees("Kresh-Aja")
plot(tree)
nodelabels(tree$node.label)
tree2 <- relabel_with_names(tree)
plot(tree2)
nodelabels(tree2$node.label)
# Replace abridged labels with names
tree3 <- abridge_labels(tree)
plot(tree3)
nodelabels(tree3$node.label)
tree4 <- relabel_with_names(tree3)
plot(tree4)
nodelabels(tree4$node.label)
# Use names from earlier glottolog version:
tree5 <- relabel_with_names(tree, glottolog_version = "4.3")
plot(tree5)
nodelabels(tree5$node.label)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.