Complete panel spans by filling interior gaps
panel_complete.RdTurns every segmented organization into a seamless one by inserting the
missing interior years and filling their numeric fields, so each
organization is observed continuously across its own span. This is the
researcher-facing wrapper over panel_impute(): it fills gaps for all
boundary types (not just panel-spanning organizations) and interpolates by
default.
Usage
panel_complete(
data,
method = c("interpolate", "mean", "locf", "nocb"),
types = c("persistent", "entrant", "exit", "transient"),
max_gap_size = Inf,
max_gap_count = Inf,
vars = NULL,
time = "TAX_YEAR",
id = "EIN2",
as_integers = FALSE,
classification = NULL,
reconcile = FALSE,
reconcile_fixed = NULL,
reconcile_section = NULL
)Arguments
- data
A panel data frame.
- method
Fill method:
"interpolate"(linear, the default),"mean","locf"(carry forward), or"nocb"(carry backward).- types
Panel types eligible for completion. Defaults to every span type; only
segmentedorganizations have interior years to fill.- max_gap_size, max_gap_count
Optional gap-size / gap-count limits per organization.
- vars
Numeric variables to fill;
NULLselects numeric non-key fields.- time
Panel-time column.
- id
Panel-ID column.
- as_integers
Round filled values for originally integer fields.
- classification
Optional classification from
panel_describe().- reconcile
If
TRUE, snap the newly filled rows to the accounting identities withreconcile()after imputation. Filling a whole row preserves linear identities, but rounding (as_integers) or an inconsistent bracketing observation can leave an imputed row off-balance; this corrects it with the least change.- reconcile_fixed, reconcile_section
Passed to
reconcile()whenreconcile = TRUE(columns to hold fixed; identity sections to enforce).
Details
Completion never extends past an organization's observed span – it fills the
holes, it does not extrapolate to the panel edges. Inserted rows are flagged
with imputed_row.