seriesLag | R Documentation |
Returns a lagged/leading timeSeries
or signalSeries
object.
seriesLag(X, k = 1, trim = FALSE, pad = NA)
X |
an object of class |
k |
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. |
trim |
a logical flag. If |
pad |
any padding to fill in the beginning or ending missing values.
The default is |
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.
lag
, shift
.
x <- timeSeries(data=data.frame(x=1:10, y=11:20),
from="7/4/2000", by="bizdays")
seriesLag(x, 1)
seriesLag(x, -1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.