Combine data.frames by row, using only common columns.
rbind_common.rd
rbind
s a list of data.frames, using only these columns which occur
in each of the single data.frames.
Arguments
- ...
input data frames to row bind together. The first argument can be a list of data frames, in which case all other arguments are ignored. Any NULL inputs are silently dropped. If all inputs are NULL, the output is NULL. If the data.frames have no common columns, the output is NULL and a warning is given.
Examples
### data frame 1
df1 <- data.frame ( a = 1:3, b = TRUE)
### data frame 2
df2 <- data.frame ( d = 100, a = 11:13)
### data frame 3
df3 <- data.frame ( d = 1000, x = 101:103)
### one common col
rbind_common(df1, df2)
#> a
#> 1 1
#> 2 2
#> 3 3
#> 4 11
#> 5 12
#> 6 13
### no common cols
rbind_common(df1, df2, df3)
#> Warning: No common column names found.
#> NULL