Learn R Programming

genvar (version 0.0.2.0)

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

Description

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

Usage

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

Run this code
# NOT RUN {
library(plm)
data(Produc)
use(Produc, clear=TRUE)
xtset(year, state)
gen(Lemp, L(emp))
gen(L2emp, L(emp,2))
headdata(10)
# }

Run the code above in your browser using DataLab