getTree {qlcData} | R Documentation |
Extract parts out of the full Glottolog 2016 tree
Description
getTree is a convenience function to extract parts from the Glottolog 2016 data as provided here in glottolog
.
Usage
getTree(up = NULL, kind = "iso", down = NULL, reduce = FALSE)
Arguments
up |
a vector of names from which to extract the tree upwards. Can be names from Glottolog, ISO 639-3 codes, WALS codes or glottocodes. Default settings expect ISO 639-3 codes. |
kind |
what kind of names are specified in |
down |
a vector of family names from Glottolog from which to extract the tree downwards. For consistency, a node "World" as added on top, linking separate families. Specifying families that are part of other families in |
reduce |
remove all nodes in the tree that do not branch. |
Details
Specifying both up
and down
will extract only the intersection of the two. So any name in up
that lies outside any family in down
will be discarded.
Value
Returns a data.frame with the relevant lines from the full glottolog data.
Note
This function is hard-coded to only use the data as available in glottolog
.
Author(s)
Michael Cysouw <cysouw@mac.com
See Also
asPhylo
for tweaking branch lengths in phylo conversion.
Examples
# use getTree() to select genealogical parts of the data
data(glottolog)
( aalawa <- getTree(up = "aala1237", kind = "glottocode") )
( kandas <- getTree(down = "Kandas-Duke of York") )
( treeFull <- getTree(up = c("deu", "eng", "ind", "cha"), kind = "iso") )
( treeReduced <- getTree(up = c("deu", "eng", "ind", "cha"), kind = "iso", reduce = TRUE) )
# use FromDataFrameNetwork() to visualize the tree
# and export it into various other tree formats in R
library(data.tree)
treeF <- FromDataFrameNetwork(treeFull)
treeR <- FromDataFrameNetwork(treeReduced)
plot(treeF)
plot(treeR)
# turn into phylo format from library 'ape'
t <- as.phylo.Node(treeR)
plot(t)
# turn into dendrogram
t <- as.dendrogram(treeF)
plot(t, center = TRUE)