I have a very large dataset that I need to reshape from wide to long.
Here is a demo of my datset which contains all the situation:
genename case1 case2 case3 strand
TP53 1 0 1 pos
TNN 0 0 1 pos
CD13 0 0 0 pos
AP35 1 1 1 neg
And the case will be only kept and reshape to longitudinal when an 1
exist, just like the following:
genename case strand
TP53 case1 pos
TP53 case3 pos
TNN case3 pos
AP35 case1 neg
AP35 case2 neg
AP35 case3 neg
How could I process this kind of reshape in R?