balance_panel: Make panel data balanced

View source: R/balanced_panel.R

balance_panelR Documentation

Make panel data balanced

Description

Make panel data balanced

Usage

balance_panel(
  df,
  type = c("fill_NA", "drop_individuals", "drop_times"),
  index = NULL,
  individual_var = NULL,
  time_seq = NULL
)

Arguments

df

an object of class 'data.frame', 'tibble'

type

character, one of '"fill_NA"', '"drop_individuals"', or '"drop_times"', see **Details**,

index

only relevant for 'data.frame' interface; if 'NULL', the first two columns of the data.frame are assumed to be the index variables; if not 'NULL', both dimensions ('individual', 'time') need to be specified by 'index' as character of length 2 for data frame.

individual_var

default is NULL; time invariant variables in the dataset, when balancing dataset they would keep the same by '"updown"' search.

time_seq

default is NULL; window for balancing panel data set.

Examples

data("EmplUK", package = "plm")
EmplUK %>%
select(year, firm) %>%
filter(firm %in% c(1:10)) %>%
table()

balance_panel(EmplUK, type = "fill_NA", individual_var = c("sector"))

WayneLockon/FinMetric documentation built on July 17, 2025, 12:10 a.m.