Thanks Gabor - I'll check it out.

Actually I just realised I can also do what I am looking for in a  
ridiculously simple manner (as the data I have is intra-day):

aggregate(l.zoo, hours(index(l.zoo)), mean)

Cheers
-- Rory

On Jun 16, 2009 2:46pm, Gabor Grothendieck <ggrothendi...@gmail.com> wrote:
> See R News 4/1.



> On Tue, Jun 16, 2009 at 9:04 AM, rory.wins...@gmail.com> wrote:

> > Hi all

> >

> > I have an irregular zoo series, where the time index looks like the

> > following:

> >

> >> head(time(l.zoo))

> >

> > [1] "2009-06-15 01:44:20.802 GMT" "2009-06-15 01:44:20.812  
> GMT" "2009-06-15

> > 01:44:20.837 GMT" "2009-06-15 01:44:20.848 GMT" "2009-06-15 06:00:01.320

> > GMT"

> > [6] "2009-06-15 06:00:01.330 GMT"

> >

> >> as.numeric(head(time(l.zoo)))

> >

> > [1] 1245030261 1245030261 1245030261 1245030261 1245045601 1245045601

> >

> >> epoch + as.numeric(head(time(l.zoo)))

> >

> > [1] "2009-06-15 01:44:20.802 GMT" "2009-06-15 01:44:20.812  
> GMT" "2009-06-15

> > 01:44:20.837 GMT" "2009-06-15 01:44:20.848 GMT" "2009-06-15 06:00:01.320

> > GMT"

> > [6] "2009-06-15 06:00:01.330 GMT"

> >

> >

> > What I would like to do is to run aggregate() over this zoo series, and

> > compute a statistic over say a 5-minute or 1-hour interval. However, I  
> cant

> > seem to get chron() to figure out the right dates:

> >

> >> chron(as.numeric(head(time(l.zoo))))

> >

> > [1] (01/28/47 19:14:53) (01/28/47 19:29:17) (01/28/47 20:05:17)  
> (01/28/47

> > 20:21:07) (01/28/89 07:40:48) (01/28/89 07:55:12)

> >

> >> epoch

> > [1] "1970-01-01 GMT"

> >

> >

> >> chron(as.numeric(head(time(l.zoo))), origin.=epoch)

> > [1] (12/20/64 19:14:53) (12/20/64 19:29:17) (12/20/64 20:05:17)  
> (12/20/64

> > 20:21:07) (12/22/06 07:40:48) (12/22/06 07:55:12)

> >

> > Does anyone know what I am doing wrong here?

> >

> > Cheers

> > -- Rory

> >

> > [[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.

> >


        [[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.

Reply via email to