extractTree: Get tree from tree+data object

Description Usage Arguments Details Author(s) See Also Examples

Description

Extracts a phylo4 tree object from a phylo4d tree+data object.

Usage

1

Arguments

from

a phylo4d object, containing a phylogenetic tree plus associated phenotypic data. Created by the phylo4d() function.

Details

extractTree extracts just the phylogeny from a tree+data object. The phylogeny contains the topology (how the nodes are linked together), the branch lengths (if any), and any tip and/or node labels. This may be useful for extracting a tree from a phylo4d object, and associating with another phenotypic dataset, or to convert the tree to another format.

Author(s)

Ben Bolker

See Also

phylo4, phylo4d, coerce-methods for translation functions.

Examples

1
2
3
4
5
6
7
8
tree.phylo <- ape::read.tree(text = "((a,b),c);")
tree <- as(tree.phylo, "phylo4")
plot(tree)
tip.data <- data.frame(size = c(1, 2, 3), row.names = c("a", "b", "c"))
(treedata <- phylo4d(tree, tip.data))
plot(treedata)
(tree1 <- extractTree(treedata))
plot(tree1)

Example output

  label node ancestor edge.length node.type size
1     a    1        5          NA       tip    1
2     b    2        5          NA       tip    2
3     c    3        4          NA       tip    3
4  <NA>    4        0          NA      root   NA
5  <NA>    5        4          NA  internal   NA
  label node ancestor edge.length node.type
1     a    1        5          NA       tip
2     b    2        5          NA       tip
3     c    3        4          NA       tip
4  <NA>    4        0          NA      root
5  <NA>    5        4          NA  internal

phylobase documentation built on May 2, 2019, 6:49 p.m.