I have a dataframe which includes all the nodes' connections in a network and I want to create a new dataframe named 'nodes' with all the unique nodes. Im trying to do something like
eids<-as.factor(d$from)
mids<-as.factor(d$to)
nodes<-data.frame(c(eids,mids))
nodes<-unique(nodes)
but when I try to create the graph I get:Some vertex names in edge list are not listed in vertex data frame
which means that part of my data is missed with this method. My dataset is quite large so I put a toy dataset here.
from<-c(2,3,4,3,1,2)
to<-c(8,8,7,5,6,5)
d<-data.frame(from,to)