I get similar timings to arun, with the data.table call being a lot slower
than the other timings. If data.table is not optimized for that .SD
expression, perhaps that is okay because, as Arun pointed out, there are
alternatives.. I can't guess why it would perform differently on different
hardware, though...

# alternatives:
a <- dt1[dt1[, .I[.N], by='Date']$V1]
b <- dt1[J(unique(Date)),,mult='last'] # a little slower
d <- dt1[, .SD[.N], by='Date'] # 600x slower; it would take ages to
benchmark
identical(a,b) # true
identical(a,d) # false
identical(as.data.frame(d),as.data.frame(a)) # true

--Frank
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to