lag_panel: Lag a variable in a panel

Description Usage Arguments Value Examples

View source: R/utilities.R

Description

A function that lags a variable, respecting panel id structure and missing values. Assumes annual panel data, and difference between year is 1, and year is a number.

Usage

1
lag_panel(tbl, id_var = "id", t_var = "year", x_var, l_var = NULL)

Arguments

tbl

A tbl of panel data; id “'id“', year “'year“'

w_var

The (quoted or unquoted) name of the weight variable to create.

Value

A tbl of panel data with weights applied.

Examples

1
2
asm <- fakedata::fake_panel(N = 10, T = 15, I = 2)
lag_panel(tbl, id, year, sales, "l_sales")

tweed1e/idiosyncratics documentation built on May 29, 2019, 10:51 a.m.