I have the following example data set
| A | B | C | D |
|---|---|---|---|
| foo | 0 | 1 | 1 |
| bar | 0 | 0 | 1 |
| baz | 1 | 1 | 0 |
How could extract the column names of each 1 occurrence in a row and put that into another column E so that I get the following table:
| A | B | C | D | E |
|---|---|---|---|---|
| foo | 0 | 1 | 1 | C, D |
| bar | 0 | 0 | 1 | D |
| baz | 1 | 1 | 0 | B, C |
Note that there can be more than two 1s per row.