Savitzky-Golay Filters: time series using EVI

Hi all,
I am getting an error on a Savitzky-Golay Filters: Approximating Time Series using R while trying to execute Savitzky-Golay filter using a function from the signal package. I am attaching the code and the error it produces below.

fun <- function(x) {
v=as.vector(x)
z=substituteNA(v, type='mean')
EVI_RSM_stack.ts2 = ts(z, start=c(2018,05), end=c(2018,08), frequency=16)
x=sgolayfilt(EVI_RSM_stack.ts2, p=1, n=3, ts=30)
}

EVI_RSM_stack.filtered <- calc(EVI_RSM_stack, fun)

The error is
Error in .calcTest(x[1:5], fun, na.rm, forcefun, forceapply) :
cannot use this function

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.