【发布时间】:2018-03-29 08:07:11
【问题描述】:
我正在使用zoo::rollmean 来计算移动平均线。但是,平均每个值的窗口的大小是恒定的k(我想在rollmean 实现中出于性能原因)。
是否存在可以接受动态窗口的移动平均线的 R 实现?
toSmoothed = c(1,2,3,2,1,2,3,2)
dynamicRange = c(1,2,1,2,1,2,1,2)
foo(toSmoothed, dynamicRange, fill = NA, align = "left") # please notice the aligned left
# return
# c(1,2.5,3,1.5,1,2.5,3,NA)
【问题讨论】: