apply_to_columns: Apply Function to Matrix Columns
Description
Applies a univariate filtering or transformation function to each column
of a matrix and returns a consolidated data frame. This utility enables
batch processing of panel data where each column represents a different
variable or series.
A data frame with the same number of rows as X, containing the
processed output for each column.
Arguments
X
Matrix or data frame where each column is a series to process.
FUN
Function to apply to each column. Must accept a numeric vector
and return either a numeric vector of the same length or a list with
a named element (specified by extract).
extract
Character string specifying which element to extract from
the function output if it returns a list. Default is NULL (use raw output).
...
Additional arguments passed to FUN.
verbose
Logical indicating whether to print progress messages.