I have dataframe with categorical variable Segment
ID Segment Var
1 AAA 1
2 BBB 0
3 BBB 1
4 AAA 1
5 CCC 1
6 AAA 0
7 AAA 1
8 AAA 0
9 BBB 0
10 CCC 0
And I would like to transform column Segment into 3 category like this:
ID SegmentAAA SegmentBBB SegmentCCC
1 1 null null
2 null 0 null
3 null 1 null
4 1 null null
5 null null 1
6 0 null null
7 1 null null
8 0 null null
9 null 0 null
10 null null 0
Could you please help me with that. Thank you very much.