as.treedata: as.treedata

Description Usage Arguments Value Examples

View source: R/AllGenerics.R

Description

convert a tree object to treedata object

Usage

1
2
3
4
as.treedata(tree, ...)

## S3 method for class 'tbl_tree'
as.treedata(tree, ...)

Arguments

tree

tree object

...

additional parameters

Value

treedata object

Examples

1
2
3
4
5
6
7
library(ape)
set.seed(2017)
tree <- rtree(4)
d <- tibble(label = paste0('t', 1:4),
           trait = rnorm(4))
x <- as_tibble(tree)
full_join(x, d, by = 'label') %>% as.treedata

Example output

Attaching package: 'tidytree'

The following object is masked from 'package:stats':

    filter

'treedata' S4 object'.

...@ phylo: 
Phylogenetic tree with 4 tips and 3 internal nodes.

Tip labels:
[1] "t2" "t1" "t4" "t3"

Rooted; includes branch lengths.

with the following features available:
	'trait'.

tidytree documentation built on April 2, 2020, 5:09 p.m.