Submitted by: Matt Dowle; Assigned to: Nobody; R-Forge link
setkey(DT,colA,colB)
won't need mult="all" :
DT["value23",sum(v1),by="colB"]
but the subset is known to be already ordered. The by is the remainder of the key not used by the i.
Also, if we had a distinction between keys and unique keys, the mult argument could be set accordingly rather than the default="first" for single column keys which may well contain duplicates.
Submitted by: Matt Dowle; Assigned to: Nobody; R-Forge link
setkey(DT,colA,colB)
won't need mult="all" :
DT["value23",sum(v1),by="colB"]
but the subset is known to be already ordered. The by is the remainder of the key not used by the i.
Also, if we had a distinction between keys and unique keys, the mult argument could be set accordingly rather than the default="first" for single column keys which may well contain duplicates.