I have a dataset with different groups of variables that actually represent the same questions asked in a survey. The reason for this is that in order to observe drop-outs based on questions we randomized the order that participants viewed sections in based on their month of birth. Essentially, the dataset ends up looking like the table below. v1 is the same question as v6, v2 is the same as v7, and so on. Participants only saw each question once, so there is never a case where an individual has a nonmissing in v1-v5 if they answered v6-v10.
Code:
ID | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | v9 | v10 |
1 | 1 | 3 | 2 | 5 | 1 | |||||
2 | 1 | 4 | 5 | 2 | 2 | |||||
3 | 4 | 5 | 3 | 2 | 2 | |||||
4 | 3 | 4 | 1 | 2 | 3 | |||||
5 | 1 | 3 | 4 | 5 | 4 | |||||
6 | 2 | 5 | 5 | 2 | 3 | |||||
7 | 4 | 5 | 1 | 4 | 1 | |||||
8 | 2 | 2 | 1 | 5 | 2 | |||||
9 | 1 | 2 | 4 | 2 | 2 |
0 Response to Quickly merging chunks of variables within the same dataset
Post a Comment