I am trying to pair (~60k lines) measurement data within a sorted list. if sorting can be automated that would be great but is not needed as I can do the sorting prior to comparing the data. (sorted by group1, then set, then measurement). I'd like to be able to pair two consecutive rows (within group and set) and label them when measurements are within 20 points of each other. see example before sorting(first set) and after sorting and labeling for pairs(last set).
I hope the question is clear. I tried to make the sample dataset as generic as possible without losing the intent.
Any help would be appreciated.
<tbody>
</tbody>
<tbody>
</tbody>
I hope the question is clear. I tried to make the sample dataset as generic as possible without losing the intent.
Any help would be appreciated.
group1 | set | measurements |
1 | z | 2 |
4 | a | 32 |
4 | a | 5 |
1 | a | 3 |
1 | a | 4 |
2 | z | 5 |
2 | z | 65 |
3 | a | 1 |
1 | a | 1 |
5 | a | 6 |
5 | z | 65 |
1 | a | 2 |
1 | z | 3 |
4 | a | 43 |
3 | a | 12 |
3 | z | 3 |
4 | a | 56 |
4 | z | 6 |
4 | z | 456 |
5 | z | 654 |
2 | z | 3 |
2 | z | 3 |
5 | a | 65 |
5 | z | 354 |
5 | a | 345 |
<tbody>
</tbody>
group1 | set | measurements | pair within 20 points in group1 in each set |
1 | a | 1 | pair1 |
1 | a | 2 | pair1 |
1 | a | 3 | pair2 |
1 | a | 4 | pair2 |
1 | z | 2 | pair3 |
1 | z | 3 | pair3 |
2 | z | 3 | pair4 |
2 | z | 3 | pair4 |
2 | z | 5 | null |
2 | z | 65 | null |
3 | a | 1 | pair5 |
3 | a | 12 | pair5 |
3 | z | 3 | null |
4 | a | 5 | null |
4 | a | 32 | pair6 |
4 | a | 43 | pair6 |
4 | a | 56 | null |
4 | z | 6 | null |
4 | z | 456 | null |
5 | a | 6 | null |
5 | a | 65 | null |
5 | a | 345 | null |
5 | z | 65 | null |
5 | z | 354 | null |
5 | z | 654 | null |
<tbody>
</tbody>