I want to create a leading variable in R where given old variable x
, new variable y
is such that y[t] = x[t+1]
e.g. as in Lagging Variables in R
embed()
the solution in above doesn't let you use dimension < 1. Is there an alternative built-in function that will help here?