-
Notifications
You must be signed in to change notification settings - Fork 173
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
Feature request: implement bind_rows()
#1342
Comments
bind_rows()
Relevant: tidyverse/dplyr#1045 A few notes:
Reading through the dplyr tickets I think the choice is deliberate, though I wouldn't mind a
And that's not as pretty as it could be |
I agree it would be very nice and I missed it a couple of times myself. Therefore, I opened an issue in dplyr: tidyverse/dplyr#6905. I guess the discussion should continue there for now. |
bind_rows()
in dplyr allows efficiently combining a list of data frames into a single data frame by wrappingvec_rbind
. This does not work for dbplyrtbl
objects.This is a common pattern so it would be good to implement it without needing to collect the data locally. The SQL equivalent is
UNION
, so a way to implement it would be to reduce the list using the existingunion
orunion_all
(I think dbplyr's implementation would match union_all) translation, e.g.Created on 2023-08-02 with reprex v2.0.2
This would be a straightforward way to implement it, and it produces a good translation that is similar to what someone would manually write. I think some checks would need to be done when using
select *
to ensure that column order matches, as some SQL engines check only that column types align, not column names.It would be good also to support the
.id
argument to append a column with the list name for each item. This could be achieved by runningmutate
on each item prior to the reduce operation.The text was updated successfully, but these errors were encountered: