I have a data frame A which looks like this: there are multiply recurring ID's
ID | shopping list
1 | carrot
1 | milk
1 | apple
2 | milk
2 | chicken
3 | milk
4 | carrot
and I want to get a data frame B: where there are only unique ID values and all shopping list products have their own column. If an ID has a certain product on their shopping list the value is 1 and if it's not the value is 0 for that item.
ID | milk | carrot | apple | chicken
1 | 1 | 1 | 1 | 0
2 | 1 | 0 | 0 | 1
3 | 1 | 0 | 0 | 0
4 | 0 | 1 | 0 | 0