Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Join list of data frames #7083

Open
davidrsch opened this issue Sep 7, 2024 · 0 comments
Open

Join list of data frames #7083

davidrsch opened this issue Sep 7, 2024 · 0 comments

Comments

@davidrsch
Copy link

I have encounter with the necessity of joining several tibbles, which i have nested in a list. This can be easily done using reduce function from purrr package:

library(dplyr)
library(purrr)

df1 <- tibble(
  index = 1:4,
  values = 5:8
)

df2 <- tibble(
  index = 2:4,
  first = 6:8
)

df3 <- tibble(
  index = 3:4,
  second = 7:8
)

df_list <- list(df1, df2, df3)
df_join <- df_list |> 
  reduce(left_join, by = "index")

But taken into consideration that bind_cols from dplyr already allows working with lists of data frames I think it could be a great feature the possibility of joining list of dataframes using join functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant