R: igraph, graph.data.frame error “Some vertex names in edge list are not listed in vertex data frame”

无人久伴 提交于 2019-12-12 04:20:02

问题


I am attempting to assign attributes to the vertices in my network. The code I am using is:

g2 <- graph.data.frame(edgelist2014, vertices=nodelabels2014, directed=FALSE)

where edgelist2014 is an edgelist with 514,000+ observations in this format:

fromRespondent  toRespondent   weight
1                2             6
1                3             4
...              ...           ...    
1014             1015          7

and nodelabels2014 is a data frame where the first column is fromRespondent and lists 1 - 1015 followed by 14 columns of attribute data. I have also tried this with 1 - 1014.

I run the code in multiple different ways and keep getting the error:

Some vertex names in edge list are not listed in vertex data frame. 

I know that all the observations match because I ran a merge function in Stata and every observation was matched from edgelist2014 and nodelabels2014. Please let me know what I am doing wrong.

来源:https://stackoverflow.com/questions/42788914/r-igraph-graph-data-frame-error-some-vertex-names-in-edge-list-are-not-listed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!