title: Simple conversion to edgelist with R?
body: <p>I need to do a simple data conversion in R for usage with igraph. My dataframe is in this format, grouped by <code>GROUP</code>:</p>
  
  <pre><code>    A   GROUP
  1   1       a
  2   2       a
  3   3       a
  4   4       a
  5   1       b
  6   3       b
  7   5       b
  </code></pre>
  
  <h3>1. How do I expand the groups to get an undirected edgelist <code>el</code> in this format?</h3>
  
  <pre><code>    A   B
  1   1   2
  2   1   3
  3   1   4
  4   2   3
  5   2   4
  6   3   4
  7   1   3
  8   1   5
  9   3   5
  </code></pre>
  
  <p>Note: no self-references 1-1, 2-2, 3-3, ...</p>
  
  <h3>2. How do I count A-B occurrences and create a weighted edgelist from <code>el</code>?</h3>
  
  <pre><code>    A   B   weight
  1   1   2        1
  2   1   3        2
  3   1   4        1
  4   2   3        1
  5   2   4        1
  6   3   4        1
  7   1   5        1
  8   3   5        1
  </code></pre>