Skip to content
Prev 1641 / 15274 Next

rollapply and cummin

In that case you might prefer:

# test data
set.seed(1)
z <- zoo(rnorm(25))

rollapply(z, 5, function(x) min(cumsum(x)), align = "left")

which (1) works with the old rollapply too since the function
returns a single number and (2) has the advantage of returning
a zoo object rather than a numeric vector so the time information
is not lost.
On 8/23/07, Voss, Kent <VOSSK at kochind.com> wrote: