If you only have 28 days in Feb in your series then that is what will be summed if you follow those examples. If you mean that your series does include Feb 29th but you want to exclude it from the aggregates then just remove the Feb 29th points first and work with the reduced series:
library(zoo) x <- zooreg(1:366, start = as.Date("2000-01-01")) ix <- format(time(x), "%m-%d") != "02-29" x0 <- x[ix] aggregate(x0, as.yearmon, sum) On Wed, Apr 21, 2010 at 2:03 AM, zow...@ncst.go.ke <zow...@ncst.go.ke> wrote: > Thanks Gabor, > I have got the idear how to aggregate the daily data into monthly data using > the zoo package. However, as I indicated earlier, in the series I am > analysing, 29th February of leap years are excluded (so as to have 365 days > in each year). How do I coerce(force) the the aggregate command to only sum > 28-days in February for all the years. > > Thanks > > ZABLONE OWITI > GRADUATE STUDENT > Nanjing University of Information, Science and Technology > College of International Education > Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China > Tel: +86-25-58731402 > Fax: +86-25-58731456 > Mob. 15077895632 > Website: www.nuist.edu.cn > ==================================================== > > > ________________________________ > From: "Gabor Grothendieck" <ggrothendi...@gmail.com> > Sent: Wednesday, April 21, 2010 11:46 AM > To: zow...@ncst.go.ke > Subject: Re: [R] Converting daily data series to monthly series > > There is a monthly aggregation of daily data example in the > zoo-quickref vignette: > > vignette("zoo-quickref") > > and there are also relevant examples using aggregate.zoo or duplicated > in the example section of ?aggregate.zoo > > > On Tue, Apr 20, 2010 at 11:16 PM, zow...@ncst.go.ke wrote: >> Hi Users, >> I have daily series of data from 1962 - 2000, with the data for February >> 29th in leap years excluded, leaving 365 daily values for each year. I >> wish to convert the daily series to monthly series. How can I do this >> using >> the zoo package or any other package? >> >> Thanks >> >> ZABLONE OWITI >> GRADUATE STUDENT >> Nanjing University of Information, Science and Technology >> College of International Education >> Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China >> Tel: +86-25-58731402 >> Fax: +86-25-58731456 >> Mob. 15077895632 >> Website: www.nuist.edu.cn >> ==================================================== >> >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.