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).

I tried to use dplyr but it did not work since the sort() function renders the same identifier for each row.

So I used a classical loop, but I have a large dataset and it takes too much time :

```
for (k in 1:nrow(data)){
 data$Couple[k] <- paste0(
  sort(c(as.character(data$Sp_1[k]), as.character(data$Sp_2[k])))[1],
  "_",
  sort(c(as.character(data$Sp_1[k]), as.character(data$Sp_2[k])))[2])
}

```

I would also like to have numbers rather than character strings since it would take less memory.