rollapply with “growing” window

后端 未结 2 958
抹茶落季
抹茶落季 2021-01-02 09:31

Guys, normally when you do something like:

tmp = zoo(rnorm(100), 1:100)
rollapply(tmp, 10, function(x) quantile(x, 0.05), align=\"right\")

2条回答
  •  礼貌的吻别
    2021-01-02 10:21

    rollapply in zoo can do that by specifying partial=TRUE, e.g.

    > library(zoo)
    > 
    > rollapplyr(zoo(1:20), 3, sum, partial=TRUE)
     1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 
     1  3  6  9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57
    

提交回复
热议问题