Thankyou Achim. Along these lines, how might I extract subsets from that set by day of week? eg: create a new series that includes Mondays only.
Thanks, Alf ----- Original Message ----- From: "Achim Zeileis" <[EMAIL PROTECTED]> To: "Alfonso Sammassimo" <[EMAIL PROTECTED]> Cc: <r-help@stat.math.ethz.ch> Sent: Thursday, March 29, 2007 1:16 AM Subject: Re: [R] aggregating data with Zoo > On Wed, 28 Mar 2007, Alfonso Sammassimo wrote: > >> Is there a way of aggregating 'zoo' daily data according to day of week? >> eg >> all Thursdays > > Sure, the easiest way will probably differ depending on the time stamp > class. One example might be this: > ## small example with Date index > z <- read.zoo(file.path(.find.package("zoo"), "doc", "demo1.txt"), > sep = "|", format = "%d %b %Y") > ## visualization > plot(z) > ## aggregate along week days (via POSIXlt representation) > aggregate(z, as.POSIXlt(time(z))$wday, mean) > > hth, > Z > >> I came across the 'nextfri' function in the documentation but am unsure >> how >> to change this so any day of week can be aggregated. >> >> I have used POSIX to arrange the data (not as 'zoo' series) according to >> day >> of week, but am curious if I've missed if a similar option available with >> zoo. >> >> Thank you for any help, >> >> Alf Sammassimo >> Melbourne, Australia >> >> ______________________________________________ >> R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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.