How to extract last value in each group
Hi,
On Thu, Aug 15, 2013 at 4:03 PM, arun <smartpink111 at 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