I'm working with the iGraph library and I need to run some statistical analysis on the network. I'm computing several variables using iGraph and then want to use those indicators as the dependent variable in a few regressions and the vertex attributes as the independent variables in the model.
So, I'm able to load the data, run the igraph analysis, but I'm having trouble turning the igraph object back into a data frame. I don't really need the edges to be preserved, just each vertex to be turned into an observation with the attributes serving as a column in each row.
I tried the following:
fg <- fastgreedy.community(uncompg, merges=TRUE)
z<-which.max(fg$modularity)
fgc<- community.to.membership(uncompg, fg$merges,z)
names<-array(V(uncompg)$name)
fccommunity<-array(fgc$membership)
fcresult<-as.matrix(cbind(names,fccommunity))
compg <- set.vertex.attribute(compg, "community", value=fccommunity)
uncompg<-simplify(as.undirected(compg))
hubscore<-hub.score(compg)$vector
authscore<-authority.score(compg)$vector
netdata<-as.data.frame(compg)
But it throws the following error:
cannot coerce class '"igraph"' into a data.frame
Any help or pointers would be greatly appreciated.