Guys, usually when you do something like:
tmp = zoo(rnorm(100), 1:100) rollapply(tmp, 10, function(x) quantile(x, 0.05), align="right")
rollapply right, rollapply will start calculating the value from the moment when 10 elements are available.
Unfortunately, I need something that allows you to use as much data as possible for the first 10 observations, essentially a growing data window, until there is enough data to use a sliding window, for example. 1, 1: 2, 1: 3, 1: 4, etc., until we have at least 10 elements, and then, as usual, slide the window.
Is there a better way to do this than an ugly loop?
r zoo
Dr g
source share