Skip to content
Prev 174583 / 398506 Next

performance: zoo's rollapply() vs inline

On Mon, 23 Mar 2009, Ken-JP wrote:

            
It depends what you want to do with it. If you use rollapply() for 
operations that you could do in a vectorized way then it is certainly not 
a good idea (see below). Important functions, especially rolling means, 
are special cased and are much faster than a regular rollapply().
This is really a bad example because your function is flawed (no 
dependence on "this") and it is not clear to me why you would want to use 
rollapply(). Just doing
   m/lag(m, -shift) - 1
should do the job.
Z