pd_read: Read a tree to a phylodiv object

Description Usage Arguments Value Examples

View source: R/pd_read.R

Description

Read a tree to a phylodiv object

Usage

1
pd_read(tree)

Arguments

tree

a phylogeny represented as a newick string or a 'phylo' object, or a tidytree 'tbl_tree' object

Value

an object of class 'phylodiv', a named list with slots:

- tree: phylo object - tips: tip labels - nodes: node labels

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
## Not run: 
# character
x <- "((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3);"
tree <- ape::read.tree(text = x)
z <- pd_read(tree = tree)
z

# phylo
library(ape)
data(chiroptera)
st <- ape::subtrees(chiroptera)[[393]]
x <- pd_read(tree = st)
x
x$tree
x$tips
x$nodes

# tbl_tree
library(tidytree)
library(ape)
set.seed(2017)
tree <- rtree(4)
x <- as_tibble(tree)
pd_read(x)

## End(Not run)

ropensci/phylodiv documentation built on March 13, 2020, 3:14 p.m.