use rollapply and zoo to calculate rolling average of a column of variables
问题 I want to calculate the rolling mean for all variables in column "sp". This is a sample of my data: the_date sp wins 01-06--2012 1 305 02-06--2012 1 276 03-06--2012 1 184 04-06--2012 1 248 05-06--2012 1 243 06-06--2012 1 363 07-06--2012 1 272 01-06--2012 2 432 02-06--2012 2 369 03-06--2012 2 302 04-06--2012 2 347 05-06--2012 2 357 06-06--2012 2 331 07-06--2012 2 380 01-06--2012 3 1 02-06--2012 3 2 03-06--2012 3 3 04-06--2012 3 2 05-06--2012 3 0 06-06--2012 3 2 07-06--2012 3 0 What I want, is