Transforms an unbalanced panel dataset into a balanced one by either keeping only complete units or filling missing time points with a specified value.
Column index or name identifying the individual unit (e.g., station ID, subject ID). If NULL, the first column is assumed.
time_col
Column index or name identifying the time point. If NULL, the first column matching date is used.
fill
Value used to fill missing combinations when method = "fill".
method
Balancing method: "fill" adds rows for missing unit-time combinations and fills numeric non-key columns with fill; non-numeric columns of the added rows are left as NA. "complete" keeps only units that have observations at every time point.
verbose
Logical; if TRUE, prints progress message.
Details
The function assumes that the time column is sorted and contains no duplicates within a unit. If duplicates exist, they should be handled beforehand.