I have a data table of 5 columns. I want to do a group by on one column and want to get the count of another column, id
.
I do this in this way: dt[,length(id),by=dt$cid]
.
If I also want to get sum of id
, how do I proceed?
I tried this:
dt[,(sum(id) length(id)),by=dt$cid]
but it did not work. Could you please help out.
Thanks