1 2 3
ema<-function(x, beta = 0.1, init=x[1]){ filter(beta*x,filter = 1-beta,method = "recursive", init= init) }