Flattens a metric output list into a single-level named list with prefixed column names. This is used by the simulation engine to convert metric outputs into flat columns for results collection.
Value
A named list with flattened names. Scalar values get names like
<metric_name>__<field>. Named numeric vectors get expanded to
<metric_name>__<field>__<subname>.
Flattening Rules
Scalar values become
<metric_name>__<field>Named numeric vectors expand to
<metric_name>__<field>__<subname>for each elementThe double underscore
__is used as a separator consistently
Examples
if (FALSE) { # \dontrun{
# Scalar values
flatten_metric_output(list(rmse = 0.5, n_obs = 100L), "my_metric")
# Returns: list(my_metric__rmse = 0.5, my_metric__n_obs = 100L)
# Named numeric vectors are expanded
flatten_metric_output(
list(params = c(alpha = 0.1, beta = 0.2, gamma = 0.3)),
"estimates"
)
# Returns: list(
# estimates__params__alpha = 0.1,
# estimates__params__beta = 0.2,
# estimates__params__gamma = 0.3
# )
} # }