I tried TTR::EMA and TTR::WMA or other MA functions in TTR packages and I also tried qcc::ewma and qcc::ewmaSmooth, but none of them can deal with data with NA. I know Python pandas package has function pd.ewma. I may not know R well....can anybody know such function in R?
for example, in python:
a=pd.Series([1,4, np.nan, np.nan,1])
pd.ewma(a, span=2/0.01-1)
Out[137]:
0 1.000000
1 2.507538
2 2.507538
3 2.507538
4 1.993177
dtype: float64
thanks