The expected result of using as.treedata, according to the example in the function docs:
library(ape)
library(dplyr)
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
Output:
'treedata' S4 object'.
...@ phylo:
Phylogenetic tree with 4 tips and 3 internal nodes.
Tip labels:
t4, t1, t3, t2
Rooted; includes branch lengths.
with the following features available:
'trait'.
# The associated data tibble abstraction: 7 × 4
# The 'node', 'label' and 'isTip' are from the phylo tree.
node label isTip trait
<int> <chr> <lgl> <dbl>
1 1 t4 TRUE 0.943
2 2 t1 TRUE -0.171
3 3 t3 TRUE 0.570
4 4 t2 TRUE -0.283
5 5 NA FALSE NA
6 6 NA FALSE NA
7 7 NA FALSE NA
'treedata' S4 object'.
...@ phylo:
Phylogenetic tree with 4 tips and 3 internal nodes.
Tip labels:
1, 4, 2, 3
Node labels:
5, 6, 7
Rooted; no branch lengths.
with the following features available:
'label'.
# The associated data tibble abstraction: 7 × 4
# The 'node', 'label' and 'isTip' are from the phylo tree.
node label.x isTip label.y
<int> <chr> <lgl> <chr>
1 1 1 TRUE t4
2 2 4 TRUE t2
3 3 2 TRUE t1
4 4 3 TRUE t3
5 5 5 FALSE NA
6 6 6 FALSE NA
7 7 7 FALSE NA
The expected result of using
as.treedata
, according to the example in the function docs:Output:
reprex of the issue
Output:
sessionInfo