Skip to contents

Provides a lagging mechanism for vector data.

Usage

lagged(x, lag = 1)

Arguments

x

A vec of data.

lag

An integer value.

Value

A vector with lagged values and NAs.

Author

James Balamuta

Examples

x = rnorm(10)

lagged(x, 2)
#>  [1]         NA         NA -0.7356846  0.0972098  0.7642268  0.7857579
#>  [7]  1.1820321 -0.9558760 -1.0316165  0.4336838