powered by
Returns a positions object similar to the input but shifted in time.
positions
shiftPositions(x, k=1)
returns a vector or timeDate object with the positions shifted by k steps.
timeDate
k
a vector or timeDate object. Missing values (NAs) are allowed.
NA
the number of positions the input series is to shift for the new series.
If k is a positive value, the resulting series is shifted forwards in time.
If k is a negative value, the resulting series is shifted backwards in time.
If k is a non-integer value, it is rounded to the nearest integer before the shift is applied.
lag
shiftPositions(1:10, 1) x <- as(1:10, "timeDate") shiftPositions(x)
Run the code above in your browser using DataLab