Learn R Programming

dcce (version 0.4.2)

.make_panel: Prepare a panel data frame

Description

Validates the data and index columns, sorts by unit then time, and attaches "unit_var" and "time_var" attributes. Accepts either the new unit_index/time_index arguments or the legacy index argument.

Usage

.make_panel(data, unit_index = NULL, time_index = NULL, index = NULL)

Value

A sorted data.frame with attributes unit_var and time_var.

Arguments

data

A data.frame.

unit_index

Character scalar: name of the unit identifier column.

time_index

Character scalar: name of the time identifier column.

index

Character vector of length 2 (legacy): c(unit_col, time_col). Ignored if unit_index and time_index are provided.