Hi everyone,
I have a dataset with duplicate r_ids, identified by "dup". However, the values in some of the variables are not identical. For example, for r_id (X), the MUP and GOV are 0s in the first row and 1s in the second row. I'd like to combine the duplicate in a way that zeros get replaced by 1. However, for observations like Z where GOV are both 0s, then it would remain 0. Here is an example of the data:
Thank you very much for your help in advance,
Zakia
I have a dataset with duplicate r_ids, identified by "dup". However, the values in some of the variables are not identical. For example, for r_id (X), the MUP and GOV are 0s in the first row and 1s in the second row. I'd like to combine the duplicate in a way that zeros get replaced by 1. However, for observations like Z where GOV are both 0s, then it would remain 0. Here is an example of the data:
r_id | RUCA1D | RUCA2D | HPSA | MUA | MUP | GOV | MUAP | HPSAPOP | HPSAGEO | dup |
X | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 1 |
X | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 2 |
Y | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 |
Y | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 2 |
Z | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 1 |
Z | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 2 |
Zakia
Comment