Recursively join a list of data frames.
Arguments
- dfs
A list of data frames.
- by
character vector of variable names to join by. If omitted, will match on all common variables.
- type
type of join: left (default), right, inner or full. See details for more information.
- match
how should duplicate ids be matched? Either match just the
"first"matching row, or match"all"matching rows. Defaults to"all"for compatibility with merge, but"first"is significantly faster.
Examples
dfs <- list(
a = data.frame(x = 1:10, a = runif(10)),
b = data.frame(x = 1:10, b = runif(10)),
c = data.frame(x = 1:10, c = runif(10))
)
join_all(dfs)
#> Joining by: x
#> Joining by: x
#> x a b c
#> 1 1 0.06563664 0.28841703 0.78314067
#> 2 2 0.12649262 0.01476902 0.03092390
#> 3 3 0.93733022 0.85372373 0.78942036
#> 4 4 0.21638023 0.41404783 0.16660368
#> 5 5 0.66609201 0.75101385 0.02871257
#> 6 6 0.20390068 0.71901396 0.78595116
#> 7 7 0.54859144 0.51535530 0.82530786
#> 8 8 0.82750141 0.97483626 0.96524042
#> 9 9 0.12755765 0.36077756 0.37864118
#> 10 10 0.26118612 0.17039551 0.17438633
join_all(dfs, "x")
#> x a b c
#> 1 1 0.06563664 0.28841703 0.78314067
#> 2 2 0.12649262 0.01476902 0.03092390
#> 3 3 0.93733022 0.85372373 0.78942036
#> 4 4 0.21638023 0.41404783 0.16660368
#> 5 5 0.66609201 0.75101385 0.02871257
#> 6 6 0.20390068 0.71901396 0.78595116
#> 7 7 0.54859144 0.51535530 0.82530786
#> 8 8 0.82750141 0.97483626 0.96524042
#> 9 9 0.12755765 0.36077756 0.37864118
#> 10 10 0.26118612 0.17039551 0.17438633