This function performs a position-based shift of the input vector v.
Unlike strict time-indexed helpers (such as get_lag), shiftNA()
does not rely on an explicit time index and does not propagate gaps based on
timestamps. Instead, it performs a simple index shift, padding the
resulting empty slots with NA.
Let \(n\) denote the length of v. The behaviour is:
k = 0: return v unchanged,
k > 0: lag by k positions; the first k elements are NA,
k < 0: lead by \(|k|\) positions; the last \(|k|\) elements are NA.
Formally, for k > 0,
$$
\text{out}_t =
\begin{cases}
\text{NA}, & t \le k, \\
v_{t-k}, & t > k,
\end{cases}
$$
and for k < 0,
$$
\text{out}_t =
\begin{cases}
v_{t+|k|}, & t \le n-|k|, \\
\text{NA}, & t > n-|k|.
\end{cases}
$$