Two data sets:
people <- read.table(text="
pid
1
2
3
4
", header=TRUE)
comps <- read.table(text="
pid comp rank
1 1 0
1 3 1
1 2 2
2 4 0
2 1 1
2 3 2
3 1 0
3 2 1
3 4 2
", header=TRUE)
Trying to get a data frame of each unique pid
with a list of their comparisons, like:
pid comps
1 1,3,2
2 4,1,3
3 1,2,4
Can't quite get there..