兩組數據:R:獲得匹配的數據幀的列表值
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)
試圖讓每個獨特pid
數據幀與他們比較的列表,如:
pid comps
1 1,3,2
2 4,1,3
3 1,2,4
燦「T相當那裏..
'data [,。(value = paste(value,collapse =「」)),by = group]' – Soheil