I have a table that looks like this,
ID c1 c2 c3 c4
A 23 12 45 63
A 3 1 6 17
B 3 1 4 6
B 2 2 5 3
and I would like to end up with something like this,
ID c1 c2 c3 c4
A 26 13 51 80
B 5 3 9 9
where, each cell is a sum of values that map to the same id.
I would like to solve this using R. Any thoughts? I know that if wanted to sum all values in a column i can use colsums but I am not sure how to sum the values based on a criteria.
Any help will be appreciated.
Ram
P.S: The actual table I have has 45000 rows and 72 columns.