-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
dplyr bind_rows coerces inputs where data.table rbindlist does not #1829
Comments
Please provide a minimal reproducible example. |
@hadley Does the example included work for you? |
It doesn't even fit all on one screen - please make it MINIMAL. |
@hadley Haha. Sure thing. Now painstakingly hand-formatted for your perusal. |
It's still not exactly minimal - the shorter it is the more likely that I can quickly locate the bug... |
@hadley Updated to what I would say is minimal. |
Here is a minimal reprex: l <- list(data_frame(x = chron::times(1)), data_frame(x = chron::times(2)))
bind_rows(l)
#> Source: local data frame [2 x 1]
#>
#> x
#> <dbl>
#> 1 1
#> 2 2 |
@hadley Thanks for taking this on as an enhancement request. Just wondering what the issue is? |
The problem seems more pervasive that just chron objects. For example the following coercion to l <- list(data_frame(x = zoo::as.yearmon(2016 + (c(0:3) / 12))),
data_frame(x = zoo::as.yearmon(2016 + (c(0:3) / 12))))
bind_rows(l)
With the problem occurring whether the data frames are supplied as a list or as individual data frames. It's quite an impediment to have to check/re-coerce variables types after binding. |
Now part of #2432 |
@hadley I am trying to call
bind_rows
on a list ofdata.frame
s which have the identical set of columns with the identical attributes (or at least to the extent thatclass
can tell). The columns that are getting coerced tonumeric
have the class attributesc("chron", "date", "times")
.data.table::rbindlist
is correctly handling these types. Is there a reason for this difference and isdplyr
doing the right thing anddata.table
is not? The latter certainly seems to have the more desirable outcome.Here is a reproducible example (apologies for the formatting of the
dput
output):The text was updated successfully, but these errors were encountered: