Element wise shift of vectors by k positions.

shift(x, k = 1, ..., fill = NA)

Arguments

x

a vector object.

k

a numeric with the number of elements to shift the Term vector

...

additional arguments. Currently unused.

fill

a numeric value (or NA) to fill the empty created by shifting a vector object.

Value

A shifted vector object of the same type of provided object.

Examples

shift(1:10, fill = 0)
#>  [1] 0 1 2 3 4 5 6 7 8 9

t <- term(1:10, "months")
shift(t)
#>  [1] "NA months" "1 month"   "2 months"  "3 months"  "4 months"  "5 months" 
#>  [7] "6 months"  "7 months"  "8 months"  "9 months"