I have four a data frame as follows:
| Proxyid | A | B | C | D |
|---|---|---|---|---|
| 123 | 1 | 0 | 0 | 0 |
| 456 | 1 | 1 | 1 | 1 |
| 789 | 0 | 0 | 0 | 0 |
This is the idea of the data frame. now I want to duplicate the rows where there are more than one 1. and assign values as follows.
| Proxyid | A | B | C | D |
|---|---|---|---|---|
| 123 | 1 | 0 | 0 | 0 |
| 456 | 1 | 0 | 0 | 0 |
| 456 | 0 | 1 | 0 | 0 |
| 456 | 0 | 0 | 1 | 0 |
| 456 | 0 | 0 | 0 | 1 |
| 789 | 0 | 0 | 0 | 0 |
I would really appreciate any input. Thank you.