While merging 3 data.frames using plyr
library, I encounter some values with the same name but with different values each in different data.frames.
How does the do.call(rbind.fill,list)
treat this problem: by arithmetic or geometric average?
从 rbind.fill 的帮助页面:
Combine data.frames by row, filling in missing columns. rbinds a list of data frames
filling missing columns with NA.
所以我希望它能够填充与 NA 不匹配的列。这里也没有必要使用do.call()
。
dat1 <- data.frame(a = 1:2, b = 4:5)
dat2 <- data.frame(b = 3:2, c = 8:9)
dat3 <- data.frame(a = 5:6, c = 1:2)
rbind.fill(dat1, dat2, dat3)
a b c
1 1 4 NA
2 2 5 NA
3 NA 3 8
4 NA 2 9
5 5 NA 1
6 6 NA 2
你期待不同的东西吗?