Hi Steve, Thanks. The error problem is solved by using quotes.
Will post at data-table mailing list regarding the issue of: system.time(ans <- dt1[, .SD[.N], by='Date']) # user system elapsed # 39.284 0.000 39.352 A.K. ----- Original Message ----- From: Steve Lianoglou <lianoglou.st...@gene.com> To: arun <smartpink...@yahoo.com> Cc: R help <r-help@r-project.org> Sent: Thursday, August 15, 2013 11:28 PM Subject: Re: [R] How to extract last value in each group Hi, On Thu, Aug 15, 2013 at 4:03 PM, arun <smartpink...@yahoo.com> wrote: > HI Steve, > > Thanks for testing. > > When I run a slightly bigger dataset: > set.seed(1254) > name<- sample(letters,1e7,replace=TRUE) > number<- sample(1:10,1e7,replace=TRUE) > > datTest<- data.frame(name,number,stringsAsFactors=FALSE) > library(data.table) > > dtTest<- data.table(datTest) > > system.time(res3<- dtTest[,list(Sum_Number=sum(number)),by=name]) > #user system elapsed > # 0.592 0.028 0.623 > > #Then I tried this: > > dtTest1<- data.table(datTest,key=name) > #Error: C stack usage is too close to the limit > > Cstack_info() > # size current direction eval_depth > # 8388608 7320 1 2 Do you get this stack problem if you quote `name`, eg: R> dtTest1 <- data.table(datTest, key="name") ? Perhaps we should move this to data.table-help if you want to debug further, though: https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -steve -- Steve Lianoglou Computational Biologist Bioinformatics and Computational Biology Genentech ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.