Time Series Lag/Lead Function
Returns a lagged/leading timeSeries or signalSeries object.
seriesLag(X, k = 1, trim = FALSE, pad = NA)
an object of class timeSeries or signalSeries.|
the number of positions the new time series or signal series is
to lag or lead the input series, with a positive value
resulting in a lagged series and a negative value resulting in
a leading series.
a logical flag. If TRUE, the missing values at the beginning or
end of the returned series will be trimmed. The default is
any padding to fill in the beginning or ending missing values.
The default is NA.
The difference between shift and seriesLag is
that the returned series of shift is shifted in time (position)
while the returned series of seriesLag shifts the entire data slot
but keeps the same time (position) intact.
They all work for both timeSeries and signalSeries objects.
returns a lagged or leading time (signal) series of the original data.
x <- timeSeries(data=data.frame(x=1:10, y=11:20),