嘿,我想重塑R中的data.frame,使每一行將重複與列表中的不同值,然後下一行將從第二個不同的值重複列表中的條目。重新格式化數據框與列表在R
該列表被調用,wrk,dfx是我想要重塑的數據框,listOut是我想要結束的。 非常感謝您的幫助。
> wrk
[[1]]
[1] "41" "42" "44" "45" "97" "99" "100" "101" "102"
[10] "103" "105" "123" "124" "126" "127" "130" "132" "135"
[19] "136" "137" "138" "139" "140" "141" "158" "159" "160"
[28] "161" "162" "163" "221" "223" "224" ""
[[2]]
[1] "41" "42" "44" "45" "98" "99" "100" "101" "102"
[10] "103" "105" "123" "124" "126" "127" "130" "132" "135"
[19] "136" "137" "138" "139" "140" "141" "158" "159" "160"
[28] "161" "162" "163" "221" "223" "224" ""
>dfx
projectScore highestRankingGroup
1 0.8852 1
2 0.8845 2
>listOut
projectScore highestRankingGroup wrk
1 0.8852 1 41
2 0.8852 1 42
3 0.8852 1 44
4 0.8852 1 45
5 0.8852 1 97
6 0.8852 1 99
7 0.8852 1 100
8 0.8852 1 101
...
35 0.8845 2 41
36 0.8845 2 42
37 0.8845 2 44
38 0.8845 2 45
39 0.8845 2 98
40 0.8845 2 99
41 0.8845 2 100
如何listOut'的'第33行「 'wrk'中的第一個列表中有34個元素時,是0.8845,2,41「? – 2011-04-14 18:19:20
感謝Davor提出的問題,那是我的錯誤 – wespiserA 2011-04-14 18:28:47