Vector_lag {EWS} | R Documentation |
Vector lag - data processing
Description
Compute a lagged version of a time series, shifting the time base back by a given number of observations defined by the user. The user must enter three parameters for this function: the vector, the number of lags, and a boolean variable named 'beginning'. If 'beginning'=TRUE, then the lag will be applied at the beginning of the vector whereas if 'beginning'=FALSE, then the lag will be applied at the end of the vector.
Usage
Vector_lag(Vector_target, Nb_lag, beginning)
Arguments
Vector_target |
Initial vector |
Nb_lag |
Number of lag |
beginning |
Boolean variable. If 'beginning'=TRUE, the lag is applied at the beginning of the vector. If 'beginning'=FALSE, the lag is applied at the end of the vector. |
Value
A numeric Vector.
Examples
# NOT RUN {
# Initialize the following vector
vector_example <- as.vector(1:10)
# Use Vector_lag
new_vector <- Vector_lag(Vector_target = vector_example, Nb_lag = 2, beginning = TRUE)
new_vector
# Results:
#> new_vector
#[1] 3 4 5 6 7 8 9 10
#}
[Package EWS version 0.2.0 Index]