View source: R/balanced_panel.R
balance_panel | R Documentation |
Make panel data balanced
balance_panel(
df,
type = c("fill_NA", "drop_individuals", "drop_times"),
index = NULL,
individual_var = NULL,
time_seq = NULL
)
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. |
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.