Question

I have a dataframe with three variables: ID, group, and nominated_ID. I want to know the group that nominated_ID belongs in.

I'm imagining that for each case, we take nominated_ID, find the case where it is equal to ID, and then set the nominated_Group variable in the original case equal to the group variable in the matched case. (If there is no match, set it to NA)

I wouldn't be surprised if this can be done without a loop, so I'm open-minded about the solution. Thanks so much for your help. Know that I did try to look for similar questions before posting.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top