Re: [R] aggregate

From: bogdan romocea <br44114_at_gmail.com>
Date: Thu 12 May 2005 - 06:14:37 EST

In fact since you have dates and not datetimes use as.Date() instead of strptime().

On 5/11/05, bogdan romocea wrote:
> 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:uofiowa@gmail.com]
> Sent: Wednesday, May 11, 2005 3:45 PM
> To: r-help@stat.math.ethz.ch
> 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.
>
> ______________________________________________
> 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
>



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 Received on Thu May 12 06:31:34 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:41 EST