I have a dataframe with the columns as follows:
Patient Gene
1 A
1 B
2 A
2 B
2 C
3 A
3 C
And I would like to unpivot, so each patient is a row and each gene is a column, such as in
GeneA GeneB GeneC
Patient1 1 1 0
Patient2 1 1 1
Patient3 1 0 1