Join the data from y as a list column onto x.
nest_join(x, y, by = NULL, keep = FALSE, name = NULL, ...)
A data.frame or data.table
A data.frame or data.table
A character vector of variables to join by. If NULL, the default, the join will do a natural join, using all variables with common names across the two tables.
Should the join keys from both x
and y
be preserved in the output?
The name of the list-column created by the join. If NULL
the name of y
is used.
Other parameters passed on to methods
df1 <- tidytable(x = 1:3)
df2 <- tidytable(x = c(2, 3, 3), y = c("a", "b", "c"))
out <- nest_join(df1, df2)
out
#> # A tidytable: 3 × 2
#> x df2
#> <int> <list>
#> 1 1 <tidytable [0 × 1]>
#> 2 2 <tidytable [1 × 1]>
#> 3 3 <tidytable [2 × 1]>
out$df2
#> [[1]]
#> # A tidytable: 0 × 1
#> # ℹ 1 variable: y <chr>
#>
#> [[2]]
#> # A tidytable: 1 × 1
#> y
#> <chr>
#> 1 a
#>
#> [[3]]
#> # A tidytable: 2 × 1
#> y
#> <chr>
#> 1 b
#> 2 c
#>