I have data collected from a survey. One factor variable is this:
Column1 Column2 Column3 Column4 Column5
A B C
B C
A B C D E
A C E
C E
B D E
In other words, classes propagate in many different variables. I want to create one binary variable (1 or 0) for each class (A, B, C, D, E). However, it is not clear to me how to do this. How can i do this?
EDIT
The result will be something like this:
A B C D E
1 1 1 0 0
0 1 1 0 0
1 1 1 1 1
1 0 1 0 1
0 0 1 0 1
0 1 0 1 1
source
share