猿phylo对象igraph问题

时间:2014-05-10 18:57:32

标签: r igraph

ape库中有一个函数可以将ape phylo obj转换为igraph网络或网络对象(来自R库网络)。

as.igraph(cur_Tree)

as.network(cur_Tree)

我与前者有问题:

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

发生了什么?提前谢谢。

1 个答案:

答案 0 :(得分:3)

使用as.igraph()将此树转换为igraph将需要以下hack:

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

这是因为node.label的第一个条目(或任何地方)是== ""