Learn R Programming

dcce (version 0.4.2)

L: Lag operator for dcce formulas

Description

Creates a lagged version of a variable for use inside dcce() formulas. This function is evaluated during formula processing by dcce() and should not be called directly on raw vectors outside of a dcce formula context.

Usage

L(x, k = 1L)

Value

A numeric vector of the same length as x with leading NAs.

Arguments

x

A numeric vector (column name evaluated within dcce()).

k

Integer lag order. Default 1. Positive values lag, negative lead.

Examples

Run this code
x <- c(10, 20, 30, 40, 50)
L(x, 1)   # NA 10 20 30 40
L(x, 2)   # NA NA 10 20 30

Run the code above in your browser using DataLab