balance_panel: balance a time series panel

Description Usage Arguments Details Value Examples

View source: R/balance_panel.r

Description

Balances a panel of unit-time data. Filters out units that are missing observations.

Usage

1
2
balance_panel(df, unit = unit, time = time, start = NULL,
  stop = NULL, complete_obs = TRUE)

Arguments

df

a tibble

unit

(optional) the unit variable, default is unit

time

(optional) the time variable, default is time

start

(optional) the first year in the panel (int), default is minimum observed

stop

(optional) the last year in the panel (int), default is the maximum observed

complete_obs

(optional) require units to be observed in all time periods? default is true.

Details

Give a panel of observations, this function subsets the data frame to only include those units that are observed in every time period. Optional 'start' and 'stop' times can be designated, if specified, observations before the start and stop times will be dropped. Set 'complete_obs = FALSE' to keep units that are missing some time observations during the panel.

Value

input tibble filtered to balanced panel

Examples

1
 balance_panel(df = airquality, unit = Month, time = Day)

williamlief/liefTools documentation built on Jan. 1, 2020, 6:48 p.m.