[datatable-help] .SD without by seems to fail

Joseph Voelkel jgvcqa at rit.edu
Mon Jan 9 17:45:29 CET 2012


# from  help(data.table)
DT = data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=1:9)
DT[,lapply(.SD,sum),by=x]  # this works fine

# but this fails
DT[,lapply(.SD,sum)]
# with this message: Error in lapply(.SD, sum) : object '.SD' not found

# Am I missing something obvious here?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20120109/595b5d04/attachment.htm>


More information about the datatable-help mailing list