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

[R-Forge #5690] rbindlist/rbind should be able to recycle wherever possible #524

Closed
arunsrinivasan opened this issue Jun 8, 2014 · 2 comments · Fixed by #3455
Closed

Comments

@arunsrinivasan
Copy link
Member

arunsrinivasan commented Jun 8, 2014

Submitted by: Arun ; Assigned to: Nobody; R-Forge link

I'm quite satisfied with the implementation of use.names and fill arguments and moving everything to C, with the recent commit (1266 v1.9.3). However, as written here: http://lists.r-forge.r-project.org/pipermail/datatable-help/2014-May/002552.html I'd love for the recycling feature to be present as well, as this'd allow for replacing the "binding" inside [.data.table to use rbindlist with use.names = TRUE.

This'll also solve http://lists.r-forge.r-project.org/pipermail/datatable-help/2014-April/002480.html issue (if we use rbindlist internally in [.data.table with use.names=TRUE (or keeping it as an additional argument).

@mattdowle mattdowle added this to the 1.12.2 milestone Mar 14, 2019
@mattdowle
Copy link
Member

mattdowle commented Mar 14, 2019

Planning to close this as wont-fix in the same spirit as the change in v1.12.2 to stop := from recycling.
I haven't looked through the links above yet, though. Will look at them before closing. Maybe others can comment please if this shouldn't be closed.

@mattdowle mattdowle mentioned this issue Mar 14, 2019
8 tasks
@mattdowle
Copy link
Member

mattdowle commented Mar 15, 2019

Have read the links now. I didn't realize rbindlist didn't recycle length-1 items. Agree it should do.
In Arun's post :

dt1 = data.table(x=1:3, y=4:6, z=list(1:2, 1:3, 1:4))
lst1 <- list(x=4, y=5, z=as.list(1:3))

Current behaviour :

> rbind(dt1, lst1)
Error in rbindlist(l, use.names, fill, idcol) : 
  Column 3 of item 2 is length 3 inconsistent with the first column of that item which
  is length 1. rbind/rbindlist expects each item in the input list to be a uniform list,
  data.frame or data.table
>

Expected behaviour :

rbind(dt1, lst1)
#    x y       z
# 1: 1 4     1,2
# 2: 2 5   1,2,3
# 3: 3 6 1,2,3,4
# 4: 4 5       1
# 5: 4 5       2
# 6: 4 5       3

Will do.

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

Successfully merging a pull request may close this issue.

2 participants