Trying to melt or collapse a dataframe with multiple boolean columns into a two column database with an id column and a column for the collapsed values BUT each value results in a new row.
Example beginning:
A S1 S2 S3 S4
1 ex1 1 0 0 0
2 ex2 0 1 0 0
3 ex3 0 0 1 0
4 ex4 1 1 0 0
5 ex5 0 1 0 1
6 ex6 0 1 0 0
7 ex7 1 1 1 0
8 ex8 0 1 1 0
9 ex9 0 0 1 0
10 ex10 1 0 0 0
Desired output:
A Type
ex1 S1
ex2 S2
ex3 S3
ex4 S1
ex4 S2
ex5 S2
ex5 S4
ex6 S2
ex7 S1
ex7 S2
ex7 S3
ex8 S2
ex8 S3
ex9 S3
ex10 S1
Thanks in advance!