getTree: Extract parts out of the full Glottolog 2016 tree

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/getTree.R

Description

getTree is a convenience function to extract parts from the Glottolog 2016 data as provided here in glottolog.

Usage

1
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 up? Choose one of iso, wals, glottocode or name for full names from Glottolog.

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 down will lead to a warning, but any overlap will be gracefully removed.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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) )

## Not run: 
# 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 = T)

## End(Not run)

cysouw/qlcData documentation built on Dec. 26, 2021, 6:13 p.m.