I have a dataframe that looks like this:
ID Region
1 a b c d
2 b c d e g
3 a c e f g h
.
.
.
I want to put it into a csv file that looks like this
ID a b c d e f g h
1 1 1 1 1 NA NA NA NA
2 NA 1 1 1 1 NA 1 NA
3 1 NA 1 NA 1 1 1 1
.
.
.
I can convert the dataframe into a csv file, but don't know how to format it this way. Any help would be greatly appreciated!