lundi 25 février 2019

Creating random, unique pairs based on values from other columns and then pasting values from pair's column in R

I'm hoping to randomly pair up study participants (in the "Rater" column) with other study participants (in the "Rater" column) and create a new column titled "Paired_Partner" with the person who the participant was paired with (the value from the Rater column).

However, these pairs are supposed to come from the same groups (Group_Subsets; Group 1, Group 2, Group 3, or Group 4). Each Group (Groups 1, 2, 3, and 4) has 10 raters, but Group 1 and Group 3 have 23 Donors and Group 2 and Group 4 have 20 Donors.

After these pairs are made, I'm hoping to take 4 numbers from 4 consecutive rows from a particular column (e.g., Snap_judgments, or perhaps something else, like predictions_SnapOnly) that correspond with an already pre-existing pair (e.g., the values housed in the rows for Rater p01a and Donor p13a). The Index column (know, nothang, friends, activity) corresponds with what these 4 values are. This new column would be titled Partners_judgments (or Partners_predictions_SnapOnly).

Here is a picture of the data I'm working with: https://i.stack.imgur.com/rSocb.png

Any help will be greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire