[R] How to sum and group data by DATE in data frame
clair.crossupton at googlemail.com
clair.crossupton at googlemail.com
Wed Sep 9 12:51:40 CEST 2009
Dear all,
Lets say I have a data frame as follows:
> Date <- as.Date(c('2006-08-23', '2006-08-30', '2006-09-06', '2006-09-13', '2006-09-20'))
> Income <- c(73.79, 72.46, 76.32, 72.43, 72.62)
> data.frame(Date, Income)
Date Income
1 2006-08-23 73.79
2 2006-08-30 72.46
3 2006-09-06 76.32
4 2006-09-13 72.43
5 2006-09-20 72.62
>
is there a way to group the data by month (summing the values in each
month), i.e.
Date Income
2006-08 146.25
2006-09 221.37
Thanks in advance,
C.C.
More information about the R-help
mailing list