add_weights: Calculate sales weights by year.

Description Usage Arguments Value Examples

View source: R/utilities.R

Description

A function that calculates individual weights by year.

Usage

1
add_weights(tbl, id_var = "id", t_var = "year", x_var, w_var = "w")

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
3
asm <- fakedata::fake_panel(N = 10, T = 15, I = 2)
add_weights(asm)
add_weights(asm, id, year, w)

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