Re: [R] Converting monthly data to quarterly data

2008-08-19 Thread Denise Xifara
Wonderful! Thank you very much Gabor! I'll check it out now. Kind regards, Denise 2008/8/19 Gabor Grothendieck <[EMAIL PROTECTED]> > Another possibility is to use the yearmon and yearqtr classes in the > zoo package. Assuming quarters end in Feb, May, Aug and Nov > we have (using dat from the p

Re: [R] Converting monthly data to quarterly data

2008-08-19 Thread Gabor Grothendieck
Another possibility is to use the yearmon and yearqtr classes in the zoo package. Assuming quarters end in Feb, May, Aug and Nov we have (using dat from the prior post): > library(zoo) > z <- zoo(dat$price, dat$date) > aggregate(z, as.yearqtr(as.yearmon(time(z)) + 1/12), mean) 2008 Q1 2008 Q2

Re: [R] Converting monthly data to quarterly data

2008-08-18 Thread Gavin
On Mon, 2008-08-18 at 14:31 +0100, Denise Xifara wrote: > Thank you very much Stephen, but how will aggregate deal with months that > fall outside annual quarters? eg, one extra month at the end of the dataset? [Without your data I'm kind of guessing at the exact format and problem, but the exampl

Re: [R] Converting monthly data to quarterly data

2008-08-18 Thread Denise Xifara
Thank you very much Stephen, but how will aggregate deal with months that fall outside annual quarters? eg, one extra month at the end of the dataset? 2008/8/18 stephen sefick <[EMAIL PROTECTED]> > ?aggregate > may do what you want > > On Mon, Aug 18, 2008 at 8:19 AM, Denise Xifara > <[EMAIL PROT

Re: [R] Converting monthly data to quarterly data

2008-08-18 Thread stephen sefick
?aggregate may do what you want On Mon, Aug 18, 2008 at 8:19 AM, Denise Xifara <[EMAIL PROTECTED]> wrote: > Dear R users, > > I have a dataframe where column is has countries, column 2 is dates > (monthly) for each countrly, the next 10 columns are my factors where I have > measurements for each c

[R] Converting monthly data to quarterly data

2008-08-18 Thread Denise Xifara
Dear R users, I have a dataframe where column is has countries, column 2 is dates (monthly) for each countrly, the next 10 columns are my factors where I have measurements for each country and for each date. I have attached a sample of the data in csv format with the data for 3 countries. I wou