简体   繁体   中英

ape phylo object to igraph issues

There is a function within the ape library that can convert an ape phylo obj into an igraph network or a network object (from the R library network).

as.igraph(cur_Tree)

or

as.network(cur_Tree)

I'm having issues with the former:

as.igraph(cur_Tree, directed = FALSE)

Error in graph(unname(ids[t(el)]), directed = directed) : 
At type_indexededgelist.c:117 : cannot create empty graph with negative number of vertices, Invalid value

What's going on? Thanks in advance.

Converting this tree to igraph using as.igraph() will require the following hack:

x$node.label[1] <- " "

This is because the first entry (or wherever) the node.label is == ""

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM