lagNA: Convenience function for lagging with NA

View source: R/misc.R

lagNAR Documentation

Convenience function for lagging with NA

Description

Convenience function for lagging with NA

Usage

lagNA(x, lag = 1, fill = NA)

Arguments

x

a vector to be lagged

lag

an integer for how much to lag x. lag greater than zero moves values left. lag less than zero moves values right

fill

the value to fill at the start or end of the output lagged vector

Value

a vector the same length as x

Examples

lagNA(1:10,3)
lagNA(1:10,-3)
lagNA(1:10,-3,-99)

sherrillmix/dnar documentation built on July 18, 2022, 10:07 p.m.