title: Moving vertex attribute data from igraph to matrix
body: <p>I calculated a centrality statistic on some network data in igraph, and I need help with two things (I think).</p>
  
  <p><strong>First</strong>, I want to move the vertex name (<code>V(g)$name</code>) and the new centrality measure I calculated (<code>(V(g)$eigen</code>) out of igraph an into a data frame. </p>
  
  <p>This is the first line of the <code>$names</code> and <code>$eigen</code> in my graph.</p>
  
  <pre><code>$names: year       young        head       black        cent        call      
  $eigen: 0.043284327 0.017877101 0.015949110 0.022489540 0.047533029 0.035666735 
  </code></pre>
  
  <p>I've come up with the code below, but it is only pulling the vertex names, and not including the <code>(V(g)$eigen</code> statistic I calculated. </p>
  
  <p><strong>Second</strong>, once I have both columns in the dataframe, I would like the dataframe sorted by the <code>(V(g)$eigen</code> statistic, with the largest values displaying at the top. </p>
  
  <pre><code>    #assigning eigenvector value to vertices
        V(subnet)$eigen = eigen_centrality(subnet, weights = E(subnet)$weight)
  
      #export two-column vector (vertex name, centrality)  
        subnet_matrix &lt;- as.matrix(c(V(subnet)$name), V(subnet)$eigen)
  
      #create new data frame with just those two columns  
        subnet_df = as.data.frame(subnet_matrix)
  
      #sort df by the centrality value (biggest at top)
        sort.list(subnet_df$eigen)
  </code></pre>
  
  <p>What I want it to end up looking like is this (in a data frame): </p>
  
  <pre><code>NAME     EIGEN
  cent     0.047533029
  year     0.043284327
  call     0.035666735
  black    0.022489540
  young    0.017877101
  head     0.015949110
  </code></pre>
  
  <p>Any help would be greatly appreciated. I'm new to R and coding in general, so I've been stuck on this way too long.</p>