问题
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