So I have a data frame that has a date column, an hour column and a series of other numerical columns. Each row in the data frame is 1 hour of 1 day for an entire year.
# to sum by date
rowsum(dat[-1], dat$Date)
# Hour Melbourne Southern Flagstaff
#2009-05-01 21 0 496 715
# or by month and year
rowsum(dat[-1], format(dat$Date, "%b-%y") )
# Hour Melbourne Southern Flagstaff
#May-09 21 0 496 715