I have data which looks like this:
Time ColA ColB ColC
0 1 10 5
1 3 7 15
2 0 8 9
3 3 4 5
4 4 5 6
7 10 23 4
I'd like to group my data into time intervals of equal size and sum the variables of each column. This, for instance, would be the result of grouping the time by 2:
Time ColA ColB ColC
0 4 17 20
2 3 12 14
4 4 5 6
7 10 23 4
I could label the data by introducing a new column whose value is floor(data$Time/2)
, but it's unclear how to do the summations. Most of the packages I've looked at seem to summarise only a single column, whereas I would like to summarise all the columns.