Here's a toy example of my problem. The dataset below describes 3 horse races, in which a total of 10 horses (numbered 1 to 10) were ridden by a total of 6 jockeys, labeled A to F. Jockeys and horses constitute a two-mode network, with jockeys connected by horses that they have in common.
Not every jockey is connected, though. For example, jockey B is not connected because (s)he rode horse 2, which no other jockey rode. I believe all the other jockeys are connected, though. So from the jockeys' point of view there are two network components, one consisting of jockeys A, C, D, E, F, and one consisting of jockey B.
What I'd like to do is add a column that indicates which component each jockey is part of.
What's the simplest way to do this? I waded into the nwcommands suite, and quickly got lost. I don't actually need to do any network analysis beyond identifying the components, so a simple solution will do.
This is the input dataset:
This is the desired output dataset:
Not every jockey is connected, though. For example, jockey B is not connected because (s)he rode horse 2, which no other jockey rode. I believe all the other jockeys are connected, though. So from the jockeys' point of view there are two network components, one consisting of jockeys A, C, D, E, F, and one consisting of jockey B.
What I'd like to do is add a column that indicates which component each jockey is part of.
What's the simplest way to do this? I waded into the nwcommands suite, and quickly got lost. I don't actually need to do any network analysis beyond identifying the components, so a simple solution will do.
This is the input dataset:
Code:
input Race Horse str1 Jockey 1 1 "A" 1 2 "B" 1 3 "C" 1 4 "D" 1 5 "E" 2 3 "A" 2 4 "C" 2 5 "D" 2 6 "E" 2 7 "F" 3 5 "A" 3 7 "C" 3 8 "D" 3 9 "E" 3 10 "F" end
Code:
input Race Horse Jockey Component 1 1 "A" 1 1 2 "B" 2 1 3 "C" 1 1 4 "D" 1 1 5 "E" 1 2 3 "A" 1 2 4 "C" 1 2 5 "D" 1 2 6 "E" 1 2 7 "F" 1 3 5 "A" 1 3 7 "C" 1 3 8 "D" 1 3 9 "E" 1 3 10 "F" 1 end
Comment