|
Suppose I have a following dataset
Id a1
1 2
2 5
3 4
4 1
I want a1 to be expressed in a set of indicator variables. The number of
indicator vars is determined by the max of a1. The result dataset needs to
be like
id b1 b2 b3 b4 b5
1 0 1 0 0 0
2 0 0 0 0 1
3 0 0 0 1 0
4 1 0 0 0 0
Any input? TIA.
|