Re: [R] Getting Annual (Conditional) Averages

2007-11-17 Thread Gabor Grothendieck
On Nov 17, 2007 8:55 AM, Emmanuel Charpentier <[EMAIL PROTECTED]> wrote: > Dear Lucia, > > lucia a écrit : > > Hello, > > I'm very new to R, and so my question is simple. > > > > I have data record with 80 years of daily temperatures in one long > > string. The dates are also recorded, in YYMMDD f

Re: [R] Getting Annual (Conditional) Averages

2007-11-17 Thread Gabor Grothendieck
On Nov 17, 2007 8:55 AM, Emmanuel Charpentier <[EMAIL PROTECTED]> wrote: > Dear Lucia, > > lucia a écrit : > > Hello, > > I'm very new to R, and so my question is simple. > > > > I have data record with 80 years of daily temperatures in one long > > string. The dates are also recorded, in YYMMDD f

Re: [R] Getting Annual (Conditional) Averages

2007-11-17 Thread Emmanuel Charpentier
Dear Lucia, lucia a écrit : > Hello, > I'm very new to R, and so my question is simple. > > I have data record with 80 years of daily temperatures in one long > string. The dates are also recorded, in YYMMDD format. I'd like to > learn an elegant simple way to pull out the annual averages.

Re: [R] Getting Annual (Conditional) Averages

2007-11-17 Thread Gabor Grothendieck
Assuming we use zoo, we define a test series, z, and then aggregate it: > library(zoo) > z <- zooreg(1000:2000, start = as.Date("2000-01-01")) > aggregate(z, as.numeric(format(time(z), "%Y")), mean) 2000 2001 2002 1182.5 1548.0 1865.5 See: vignette("zoo") vignette("zoo-quickref") ?zoo

[R] Getting Annual (Conditional) Averages

2007-11-17 Thread lucia
Hello, I'm very new to R, and so my question is simple. I have data record with 80 years of daily temperatures in one long string. The dates are also recorded, in YYMMDD format. I'd like to learn an elegant simple way to pull out the annual averages. (Obviously, every 4th year has 366 days