[R-SIG-Finance] Applying function on rolling window basis ** not rollapply() function in zoo

Brian G. Peterson brian at braverock.com
Tue Jan 4 14:41:14 CET 2011

On 01/04/2011 07:52 AM, Bogaso Christofer wrote:
> I was trying the example given in apply.rolling() function, however it is
> not that what I wanted. Let me simulate it here:
> What I wanted to have is (0.0074+0.0193+0.0155)/3,
> (-0.0091+0.0076+-0.0039)/3 (with window size 3) etc... Do I need to put any
> further argument in that function?

apply.rolling will use a fixed width and *roll* which is what you 
subject says you want.

?period apply

will apply on a endpoints(time)-based period, like days, months, and 
years, using 'periodicity' in xts.  so, quarterly mean, for example, 
would be period.apply with endpoints on quarters or use apply.quarterly. 
  With period.apply, you can also send in a vector of endpoints, which 
can be arbitrary.

So, I think I already gave you all the information you need to do what 
you want.

  - Brian

More information about the R-SIG-Finance mailing list