Thanks Dennis and Daniel for your reply!

On Wed, Apr 7, 2010 at 12:24 PM, Daniel Malter <daniel@umd.edu> wrote:

>
> Assume you have suitable "week" indicator and your data is stored in a
> data.frame named "data." Then you get the weekly averages by
>
> #simulate data
> week <- rep(1:52,each=7)
> x <- week+rnorm(52*7,)
> y  <- rev(week)+rnorm(52*7)
>
> #create data frame
> data=data.frame(week,x,y)
>
> #get weekly averages in a list
> averages=unlist(lapply(split(data,week),colMeans))
>
> #unlist averages and store the results in matrix
> matrix(averages,byrow=T,ncol=dim(data)[2])
>
> HTH,
> Daniel
> --
> View this message in context:
> http://n4.nabble.com/finding-weekly-average-tp1754518p1754604.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

