title: Calculate degree, closeness and betweenness in R
body: <p>I have a data table which consists of names of users who post in the same thread in a forum, it looks like that:
     X1   X2
  1. g79  kian
  2. g79  greyracer
  3. g79  oldskoo1 ...</p>
  
  <p>I need to calculate degree, closeness and betweenness. I'm using the following code:</p>
  
  <pre><code>library(igraph)
  setwd("/Volumes/NATASHKA/api/R files")
  load("edgelist_one_mode.rda")
  load("map.rda")
  load ("result.rda")
  el &lt;- as.matrix(whatwewant)
  el[,1] &lt;- as.character(el[,1])
  el[,2] &lt;- as.character(el[,2])
  g &lt;- graph.data.frame(el, directed=FALSE)
  plot(g, edge.arrow.size=.5)
  indegreeG &lt;- degree(g, mode="in")
  outdegreeG &lt;- degree(g, mode="out")
  totaldegreeG &lt;- degree(g)
  inclosenessG &lt;- closeness(g, mode='in')
  outclosenessG &lt;- closeness(g, mode='out')
  totalclosenessG &lt;- closeness(g)
  betweennessG &lt;- betweenness(g)
  forumG &lt;- data.frame(V(g)$name, indegreeG, outdegreeG, totaldegreeG, inclosenessG,    outclosenessG, totalclosenessG, betweennessG)
  write.table(forumG,file="forumG.csv",sep=";")
  </code></pre>
  
  <p>The question is why do I get the same values for in-degree, out-degree and total-degree, the same for closeness? Besides, at the beginning I have 41213 users, but after analysis (when I calculate degree, etc..) I only have 37874. How could I lose so many observations? Please tell me if I have a mistake in the code.</p>
  
  <p>Thanks</p>