title: Convert a data.frame to a adjacency matrix (R)
body: <p>I want to transform a data.frame to an adjacency matrix. In my data, I got articles and authors (several columns, one for each coauthor), where each row is an article. I want authors of the same article to be tied.</p>
  
  <p>The data structure is now like this: </p>
  
  <pre class="lang-r prettyprint-override"><code>data &lt;- data.frame(Author1 = c("Alan", "Rebecca", "Micheal", "Dany", "Euron", "Alan"),
                     Author2 = c("Rebecca", NA, "Alan", "Euron", NA, "Dany"),
                     Author3 = c("Dany", NA, "Euron", "Micheal", NA, NA),
                     Author4 = c("Euron", NA, "Rebecca", NA, NA, NA),
                     Title = c("Eric's boat", "Top 100 boats", "Boats in the World", "Death and boats", "Boats and Dragons", "Boats"))
  </code></pre>
  
  <p>Which gives this output: </p>
  
  <pre><code>+---------+---------+---------+---------+--------------------+
  | Author 1| Author2 | Author3 | Author4 | Title              |
  +---------+---------+---------+---------+--------------------+
  | Alan    | Rebecca | Dany    | Euron   | Eric's boat        |
  | Rebecca | NA      | NA      | NA      | Top 100 boats      |
  | Micheal | Alan    | Euron   | Rebecca | Boats in the world |
  | Dany    | Euron   | Micheal | NA      | Death and boats    |
  | Euron   | NA      | NA      | NA      | Boats and Dragons  |
  | Alan    | Dany    | NA      | NA      | Boats              |
  +---------+---------+---------+---------+--------------------+
  </code></pre>
  
  <p>I want it to look like this:</p>
  
  <pre><code>+---------+------+---------+---------+------+-------+
  |         | Alan | Rebecca | Micheal | Dany | Euron |
  +---------+------+---------+---------+------+-------+
  | Alan    |    0 |       1 |       0 |    1 |     1 |
  | Rebecca |    1 |       0 |       1 |    0 |     0 |
  | Micheal |    1 |       1 |       1 |    1 |     1 |
  | Dany    |    1 |       0 |       1 |    0 |     1 |
  | Euron   |    1 |       0 |       1 |    1 |     0 |
  +---------+------+---------+---------+------+-------+
  </code></pre>