title: Convert igraph object to a data frame in R
body: <p>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. </p>
  
  <p>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. </p>
  
  <p>I tried the following: </p>
  
  <pre><code>fg &lt;- fastgreedy.community(uncompg, merges=TRUE)
  z&lt;-which.max(fg$modularity)
  fgc&lt;- community.to.membership(uncompg, fg$merges,z)
  names&lt;-array(V(uncompg)$name)
  fccommunity&lt;-array(fgc$membership)
  fcresult&lt;-as.matrix(cbind(names,fccommunity))
  compg &lt;- set.vertex.attribute(compg, "community", value=fccommunity)
  
  uncompg&lt;-simplify(as.undirected(compg))
  hubscore&lt;-hub.score(compg)$vector
  authscore&lt;-authority.score(compg)$vector
  
  netdata&lt;-as.data.frame(compg)
  </code></pre>
  
  <p>But it throws the following error: </p>
  
  <pre><code>  cannot coerce class '"igraph"' into a data.frame
  </code></pre>
  
  <p>Any help or pointers would be greatly appreciated. </p>