Skip to content

Implement nest_join #3570

@hadley

Description

@hadley

A nest_join() would create a list-column:

library(tibble)

df1 <- tibble(x = c(1, 2), y = c(2, 3))
df2 <- tibble(x = c(1, 1), z = c(2, 3))

# nest_join(df1, df2)
# Would yield:
out <- df1
out$df2 <- list(df2, NULL)
out
#> # A tibble: 2 x 3
#>       x     y df2             
#>   <dbl> <dbl> <list>          
#> 1     1     2 <tibble [2 × 2]>
#> 2     2     3 <NULL>

The output would always have exactly the same rows as the input, but with one new column, named (by default) with the name of y. unnest()ing this data frame would yield an inner_join() (or a left_join() with tidyverse/tidyr#358)

@romainfrancois how hard would this be to implement?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions