[datatable-help] Fwd: Sum on colunms by a reference column

Emmanuel Blondel emmanuel.blondel1 at gmail.com
Thu Jul 21 09:27:09 CEST 2011


Dear all,

I have a datatable (mydt) with a reference column (code) for which I set 
a key, and a set of numeric columns (A ,B, C, D, E).
I obtain this from a serie of script codes, but the issue is that I have 
duplicated rows (code), So i want to do is according to codestation, for 
each of the columns..

I could do the following code for one single column:
result<-mydt[,sum(A),by=code]

but I would like to know if it is possible to do it for each of the 
columns, so I get a databable with the same columns with sum value, 
group by codestation. Do you have any suggestion?

I thank you a lot in advance for your answer,

Best regards,
Emmanuel

-- 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20110721/1d37499a/attachment-0001.htm>


More information about the datatable-help mailing list