title: Dplyr create a unique couple ID
body: <p>I am trying to create unique IDs for two columns.
  The dataframe has two colums, Sp1 and Sp2, which are character strings.
  Sp1 and Sp2 can be the same character string.
  I want to have a unique (Sp1;Sp2) couple identifier that does not take the order of (Sp1;Sp2) into account. For instance, (A;B) should have the same identifier as (B;A).</p>
  <p>I tried to use dplyr but it did not work since the sort() function renders the same identifier for each row.</p>
  <p>So I used a classical loop, but I have a large dataset and it takes too much time :</p>
  <pre><code>for (k in 1:nrow(data)){
   data$Couple[k] &lt;- paste0(
    sort(c(as.character(data$Sp_1[k]), as.character(data$Sp_2[k])))[1],
    &quot;_&quot;,
    sort(c(as.character(data$Sp_1[k]), as.character(data$Sp_2[k])))[2])
  }
  </code></pre>
  <p>I would also like to have numbers rather than character strings since it would take less memory.</p>