[datatable-help] Unexpected behaviour using fast grouping

Arunkumar Srinivasan aragorn168b at gmail.com
Mon Aug 4 13:44:22 CEST 2014


Hi Tom,
It has been fixed in 1.9.3, bug#481. You can scroll down the project page on instructions for installation..

Best,


Arun

From: Tom Harrop <thomas.harrop at ird.fr>
Reply: Tom Harrop <thomas.harrop at ird.fr>>
Date: August 4, 2014 at 1:40:32 PM
To: datatable-help at lists.r-forge.r-project.org <datatable-help at lists.r-forge.r-project.org>>
Subject:  [datatable-help] Unexpected behaviour using fast grouping  

Hello,  

I'm trying to group a data.table that has duplicate keys, aggregating  
the values in another column by the value of the key.  

There is a question and answer on the same topic on StackOverflow  
(http://stackoverflow.com/a/17033371/3017012), but when I follow the  
accepted answer I get different results:  

> library(data.table)  
data.table 1.9.2 For help type: help("data.table")  
> dt = data.table(user_id = c(1,2,2,3), advertiser_id = c(1:4))  
> dt[,list(list(advertiser_id)), by = user_id]  
user_id V1  
1: 1 4,3  
2: 2 4,3  
3: 3 4,3  

Where I expect:  

user_id V1  
1: 1 1  
2: 2 2,3  
3: 3 4  

I can get the expected results (as above) using:  

> dt[,paste(advertiser_id, collapse = ","), by = user_id]  

Have I missed something? I'm on R 3.1.1 in case the behaviour has  
changed recently.  

Many thanks,  

Tom  
_______________________________________________  
datatable-help mailing list  
datatable-help at lists.r-forge.r-project.org  
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20140804/e97d01c1/attachment.html>


More information about the datatable-help mailing list