[英]How does plyr merge two columns of different data.frames with same names but different values
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.在使用
plyr
库合并 3 个 data.frames 时,我遇到了一些具有相同名称但在不同 data.frames 中具有不同值的值。
How does the do.call(rbind.fill,list)
treat this problem: by arithmetic or geometric average? do.call(rbind.fill,list)
如何处理这个问题:通过算术平均还是几何平均?
From the help page for rbind.fill:从 rbind.fill 的帮助页面:
Combine data.frames by row, filling in missing columns. rbinds a list of data frames
filling missing columns with NA.
So I'd expect it to fill columns that do not match with NA.所以我希望它能够填充与 NA 不匹配的列。 It is also not necessary to use
do.call()
here.这里也没有必要使用
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
Are you expecting something different?你期待不同的东西吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.