Skip to content
Back to formatted view

Raw Message

Message-ID: <4D23237A.1050500@braverock.com>
Date: 2011-01-04T13:41:14Z
From: Brian G. Peterson
Subject: Applying function on rolling window basis ** not	rollapply() function in zoo
In-Reply-To: <018501cbac16$a8395a20$f8ac0e60$@gmail.com>

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