Hello,
I'm working with a dataset of about 20 columns and 40,000 rows. The columns include a unique identifier (ID1), a non-unique identifier (ID2), and then binary variables. For example, a small section of my dataset would look like this:
ID1---------ID2-----------Red----------Green------Blue--------Orange
JS------John Smitha-------0--------------1-----------1------------0
JS------John Smithb-------1--------------1-----------0------------0
MB------Matt Brown-------0--------------1-----------1------------1
DB------David Book-------0--------------0-----------0------------1
I need to combine the ID2 entries according to their unique ID1 in a way that combines a 0 and 1 as 1, a 0 and a 0 as 0, and a 1 and a 1 as 1. For example, the new table should be as follows:
ID1-----Red----------Green------Blue--------Orange
JS--------1--------------1-----------1------------0
MB-------0--------------1-----------1------------1
DB-------0--------------0-----------0------------1
I would like to avoid doing this manually, as there are about 5,000 non-unique entries that need to be combined.
Thanks for your help!
Bookmarks