Recursively join a list of data frames.

join_all(dfs, by = NULL, type = "left", match = "all")

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.5761874 0.17235189 0.52683032 #> 2 2 0.2179058 0.69072585 0.76347483 #> 3 3 0.1258563 0.67520850 0.43538664 #> 4 4 0.9381527 0.94629485 0.55247234 #> 5 5 0.8012751 0.19621952 0.20403065 #> 6 6 0.7580536 0.96863750 0.03102602 #> 7 7 0.5325652 0.38709628 0.96970706 #> 8 8 0.5468048 0.65034390 0.17861309 #> 9 9 0.0959265 0.81459620 0.77829279 #> 10 10 0.3883498 0.07096477 0.88571080
join_all(dfs, "x")
#> x a b c #> 1 1 0.5761874 0.17235189 0.52683032 #> 2 2 0.2179058 0.69072585 0.76347483 #> 3 3 0.1258563 0.67520850 0.43538664 #> 4 4 0.9381527 0.94629485 0.55247234 #> 5 5 0.8012751 0.19621952 0.20403065 #> 6 6 0.7580536 0.96863750 0.03102602 #> 7 7 0.5325652 0.38709628 0.96970706 #> 8 8 0.5468048 0.65034390 0.17861309 #> 9 9 0.0959265 0.81459620 0.77829279 #> 10 10 0.3883498 0.07096477 0.88571080