Internal helper function for fast reconstruction of panel_data objects.
Unlike panel_data(), this does NOT validate, sort, or set up grouping
by default. It simply attaches attributes and class. Use for fast
reconstruction after operations that preserve the panel structure.
build_panel_data(
x,
id,
wave,
periods = NULL,
reshaped = NULL,
varying = NULL,
constants = NULL,
validate_order = FALSE
)A panel_data object
A data frame to convert
Name of the id column (string)
Name of the wave column (string)
Vector of time periods (optional)
Logical indicating if data was reshaped (optional)
Character vector of varying variable names (optional)
Character vector of constant variable names (optional)
If TRUE, check if data is sorted and re-sort if not. Default FALSE for speed. Set TRUE when row order might have changed.
Set validate_order = TRUE to check if data is sorted and fix if needed.
The check is O(n); sorting only happens if data is actually unsorted.