makeBalancedPanel: Balance a Panel Data Set

Description Usage Arguments Value Examples

View source: R/BMisc.R

Description

This function drops observations from data.frame that are not part of balanced panel data set.

Usage

1
makeBalancedPanel(data, idname, tname)

Arguments

data

data.frame used in function

idname

unique id

tname

time period name

Value

data.frame that is a balanced panel

Examples

1
2
3
4
5
6
id <- rep(seq(1,100,1),2) ## individual ids for setting up a two period panel
t <- rep(seq(1,2),100) ## time periods
y <- rnorm(200) ## outcomes
dta <- data.frame(id=id, t=t, y=y) ## make into data frame
dta <- dta[-7,] ## drop the 7th row from the dataset (which creates an unbalanced panel)
dta <- makeBalancedPanel(dta, idname="id", tname="t")

BMisc documentation built on Dec. 18, 2020, 5:08 p.m.