You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got error when I try to convert a tibble into a tree (either treedata or phylo) object, even if the tibble has been originally generated by a tree. See example:
library(ape , quietly=TRUE, warn.conflicts=FALSE)
library(tidytree , quietly=TRUE, warn.conflicts=FALSE)
library(treeio , quietly=TRUE, warn.conflicts=FALSE)
#> treeio v1.14.4 For help: https://yulab-smu.top/treedata-book/
set.seed(2017)
a<- rtree(4) %>% as_tibble() %>% as.data.frame()
print(a)
#> parent node branch.length label#> 1 5 1 0.434905600 t4#> 2 7 2 0.674331481 t1#> 3 7 3 0.002020766 t3#> 4 6 4 0.025093514 t2#> 5 5 5 NA <NA>#> 6 5 6 0.472166386 <NA>#> 7 6 7 0.273833123 <NA># ERROR ON BOTHa %>% as.treedata() #calls treeio:::as.treedata.data.frame which calls treeio:::as.phylo.tbl_df#> Error in check_edgelist(x): Cannot find root. network is not a tree!a %>% as.phylo() #calls treeio:::as.phylo.data.frame which is equal to treeio:::as.phylo.tbl_df#> Error in check_edgelist(x): Cannot find root. network is not a tree!
check_edgelist asks that unique(parents[!(parents %in% children)]) returns a not-zero vector, but this is in contraddiction with the nature of root node itself:
e.g. tidytree:::rootnode.tbl_tree defines the root as the node with parent==node
It is somehow related to issue #36 and also asked in SO here
I got error when I try to convert a tibble into a tree (either
treedata
orphylo
) object, even if the tibble has been originally generated by a tree. See example:check_edgelist
asks thatunique(parents[!(parents %in% children)])
returns a not-zero vector, but this is in contraddiction with the nature of root node itself:e.g.
tidytree:::rootnode.tbl_tree
defines the root as the node with parent==nodeIt is somehow related to issue #36 and also asked in SO here
Created on 2021-06-04 by the reprex package (v1.0.0)
Session info
The text was updated successfully, but these errors were encountered: