Assuming dfr["day","o","h","l","c"] and day like 2004-12-28: dt <- strptime(as.character(dfr$day),format="%Y-%m-%d") + 0 wk <- format(dt,"%Yw%U") aggr <- aggregate(list(dfr$o,dfr$h,dfr$l,dfr$c),list(wk),mean) colnames(aggr) <- etc
-----Original Message----- From: Omar Lakkis [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 11, 2005 3:45 PM To: [email protected] Subject: [R] aggregate I have a data frame of daily open, high, low and settle prices. How can I aggregate this data weekly? The data frame has five columns, the first is the date column and the rest are the prices. ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
