diffxts | R Documentation |
Calculate the time differences of an xts time series.
diffxts(xtsv, lagg = 1, ...)
xtsv |
An xts time series. |
lagg |
An integer equal to the number of time periods of lag
(default is |
... |
Additional arguments to function |
The function diffxts()
calculates the time differences of an
xts time series and pads with zeros instead of NA
s.
Positive lagg
means differences are calculated with values from
lagg
periods in the past (vice versa for a negative lagg
).
The function diff()
is just a wrapper for diff.xts()
from
package xts,
but it pads with zeros instead of NA
s.
The function diffit()
has incorporated the functionality of
diffxts()
, so that diffxts()
will be retired in future
package versions.
An xts time series with the same dimensions and the same time index as the input series.
# Calculate time differences over lag by 10 periods
rutils::diffxts(rutils::etfenv$VTI, lag=10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.