Entering edit mode
2.7 years ago
drajangirija
•
0
Hi
I have a 2 column data file .txt and I wanna convert it into a 0 1 matrix using R
Sample input
Column1 x1 x2 x3…..x100 Column2: male female both….unknown
Desired output
Column1: x1 x2 x3…..x100 Row1: male female both unknown In x1 row and male column print 1 all others 0 Same way in x2 row and female column print 1 others 0