Element wise shift of vectors by k
positions.
shift(x, k = 1, ..., fill = NA)
a vector object.
a numeric with the number of elements to shift the Term vector
additional arguments. Currently unused.
a numeric value (or NA
) to fill the empty created by
shifting a vector object.
A shifted vector object of the same type of provided object.
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 NA" "1 month" "2 months" "3 months" "4 months" "5 months"
#> [7] "6 months" "7 months" "8 months" "9 months"