## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width   = 7.5,
  fig.height  = 5
)

## -----------------------------------------------------------------------------
library(paneldesc)

## -----------------------------------------------------------------------------
data(production)

## -----------------------------------------------------------------------------
str(production)

## -----------------------------------------------------------------------------
panel <- make_panel(production, index = c("firm", "year"))

## -----------------------------------------------------------------------------
balance_entities <- make_balanced(panel, balance = "entities")
dim(balance_entities)

## -----------------------------------------------------------------------------
balance_periods <- make_balanced(panel, balance = "periods")
dim(balance_periods)

## -----------------------------------------------------------------------------
balance_rows <- make_balanced(panel, delta = 1, balance = "rows")
dim(balance_rows)

## -----------------------------------------------------------------------------
vars <- c("sales", "capital", "labor", "industry", "ownership")

## -----------------------------------------------------------------------------
panel_wide <- make_wide(panel, select = vars)

## -----------------------------------------------------------------------------
panel_long <- make_long(panel_wide, select = vars)

## -----------------------------------------------------------------------------
demeaned <- make_demeaned(panel)

## -----------------------------------------------------------------------------
summary(demeaned)

## -----------------------------------------------------------------------------
panel_means <- add_means(panel)
names(panel_means)

