I want to aggregate some columns into one using the value.
I have a matrix like this :
| X | Y1 | Y2 | Y3 | Y4 |
|----|----|----|----|----|
|id1 | 0 | 0 | 1 | 0 |
|id2 | 0 | 1 | 0 | 0 |
|id3 | 0 | 1 | 0 | 0 |
|id4 | 0 | 0 | 0 | 1 |
|id5 | 0 | 1 | 0 | 0 |
|id6 | 1 | 0 | 0 | 0 |
And I want to retrieve a matrix like this :
| X | Y |
|----|----|
|id1 | Y3 |
|id2 | Y2 |
|id3 | Y2 |
|id4 | Y4 |
|id5 | Y2 |
|id6 | Y1 |
I don't know how i can do this.
Thank you for your help.