The data frame is:
head(HSC)
Date Y1 M1 Location Year Quarter Month
2010-01-04 0.115 0.245 Chicago 2010 Q1 01
2010-01-05 0.111 0.210 Chicago 2010 Q1 01
2010-01-06 0.113 0.185 Chicago 2010 Q1 01
Then I get monthly average for Y1 and M1
HSCnew<-aggregate(cbind(Y1,M1)~Month+Year,data=HSC,mean)
Month Year Y1 M1
01 2010 -0.11935294 -0.04017647
02 2010 -0.09776471 -0.05600000
03 2010 -0.06785714 0.01271429
04 2010 -0.07315789 -0.02457895
Both month and year are characters. is there a way to add date to the right, such date=01-01-2010