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

Bug: With R 3.1.1 incorrect string grouping behavior in data.table #728

Closed
KrishnaPG opened this issue Jul 11, 2014 · 1 comment
Closed

Comments

@KrishnaPG
Copy link

Please check the below code output:

ids <- c(10, 10, 10, 11, 12, 12)
items <- c('soup', 'rice', 'lemon', 'chicken', 'lamb', 'noodles')

orders <- as.data.table(list(id=ids, item=items))
orders[,list(list(item)), by=id]

On R 3.1.1 it is producing the below (incorrect) output:

   id                 V1
1: 10 lamb,noodles,lemon
2: 11 lamb,noodles,lemon
3: 12 lamb,noodles,lemon    

where as it should be as below:

   id                 V1
1: 10 soup,rice,lemon
2: 11 chicken
3: 12 lamb,noodles

I remember this working correctly in earlier R versions, after upgrading to latest 3.1.1 started encountering this problem. (Or, if it is my mistake and I am doing something wrong, please correct me, Thanks).

@KrishnaPG KrishnaPG changed the title Bug in R 3.1.1 incorrect string grouping behavior Bug: With R 3.1.1 incorrect string grouping behavior in data.table Jul 11, 2014
@arunsrinivasan
Copy link
Member

Fix for this bug (which is a duplicate of #481) was done in commit 86276f4. And DT[, col := list(list(.)), by=.] case was recently fixed in 5e2ced0.

Should be all good now. Closing. Thanks @KrishnaPG for reporting!

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

No branches or pull requests

3 participants