L: a function to take lags and leads with panel data

Description Usage Arguments Value Examples

Description

a function to take lags and leads with panel data, mostly a wrapper for plm's lag function.

Usage

1
L(x, k = 1, ...)

Arguments

x

variable to lag

k

how many lags to take? If a negative number, leads will be generated.

...

other options to pass to plm::lag, does not need to be specified

Value

returns lag of the variable as a data frame

Examples

1
2
3
4
5
6
7
library(plm)
data(Produc)
use(Produc, clear=TRUE)
xtset(year, state)
gen(Lemp, L(emp))
gen(L2emp, L(emp,2))
headdata(10)

genvar documentation built on Jan. 21, 2020, 9:07 a.m.

Related to L in genvar...