Suppose that I have a data frame where each column is a method and each row is a metric of such method (the lower the better).
+----------+----------+
| Method 1 | Method 2 |
+----------+----------+
| 1 | 2 |
| 2 | 3 |
+----------+----------+
I would like to obtain a data frame with the count of wins and losses between all methods (potentially more than just two), a method wins if the it has a smaller metric than the other one. like this:
+----------+-----------+-----------+-----------+-----------+
| | Method 1+ | Method 1- | Method 2+ | Method 2- |
+----------+-----------+-----------+-----------+-----------+
| Method 1 | - | - | 0 | 2 |
| Method 2 | 2 | 0 | - | - |
+----------+-----------+-----------+-----------+-----------+
Where the "+" in the method name indicates that the method wins or "-" when it lost.
The trivial way would be to iterate over each row of the data frame and make the comparison among all pair of columns but is quite inefficient.
Is there a more elegant solution in R?