Hi apologies if this has been asked before, I couldn't find an answer to my question but I've been unsure on the best way to word this - so that might have hindered my searches!
So my data was originally in a matrix like this:
a | b | c | |
---|---|---|---|
a | 0 | 0.576 | 0.987 |
b | 0.576 | 0 | 0.034 |
c | 0.987 | 0.034 | 0 |
I converted this to long format using melt, and removed the zero values where a value would map to itself, so the data now looks like this:
var1 | var2 | value |
---|---|---|
a | b | 0.576 |
b | a | 0.576 |
a | c | 0.987 |
c | a | 0.987 |
b | c | 0.034 |
c | b | 0.034 |
What's the best way to remove the duplicate rows so that the data would look like:
var1 | var2 | value |
---|---|---|
a | b | 0.576 |
a | c | 0.987 |
b | c | 0.034 |