I have a large dataframe with entries in 3 columns. For simplicity and Minimal reprex I'll relate it to colors:

Let's say I asked 4 people to combine their 2 favorite colors. Some people couldn't just pick one combination so they answered twice. How can I find out the total number of unique combinations?

"red+blue" should be the same as "blue+red".

In the reprex, there should be 3 combinations (blue_green is duplicated, and yellow_red should be the same as red_yellow).

```
mydf <- data.frame("person" = c("bob", "alice", "peter", "paul", "paul"),
"color1"=c("blue","red","green","yellow", "blue"),
"color2" = c("green", "yellow", "pink", "red", "green"))
#If you combine strings...
mydf$combined <- paste0(mydf$color1, "_", mydf$color2)
```

```
> mydf
person color1 color2 combined
1 bob blue green blue_green
2 alice red yellow red_yellow
3 peter green pink green_pink
4 paul yellow red yellow_red
5 paul blue green blue_green
```

```
#And count the unique combined strings..
length(unique(mydf$combined))
```

```
#You get the wrong answer
[1] 4
```